MMMTestLoadable
Objective-C
@interface MMMTestLoadable : NSObject <MMMLoadable>
Swift
class MMMTestLoadable : NSObject, MMMLoadableProtocol
Can be used as a base for unit test (view) models conforming to MMMLoadable. Basically allows to override properties of MMMLoadable from the outside (i.e. from a unit test).
-
@{ Properties of MMMLoadable we allow to change directly without sending “did change” automatically.
Declaration
Objective-C
@property (nonatomic) BOOL needsSync;
Swift
var needsSync: Bool { get set }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, getter = isContentsAvailable) BOOL contentsAvailable
Swift
var isContentsAvailable: Bool { get set }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, nullable) NSError *error
Swift
var error: (any Error)? { get set }
-
@{ We allow to change
loadableState
directly and using shortcuts.- The “did change” notification is sent even when there was no actual change in the state.
Declaration
Objective-C
@property (nonatomic) MMMLoadableState loadableState;
Swift
var loadableState: MMMLoadableState { get set }
-
Undocumented
Declaration
Objective-C
- (void)setIdle;
Swift
func setIdle()
-
Undocumented
Declaration
Objective-C
- (void)setSyncing;
Swift
func setSyncing()
-
Undocumented
Declaration
Objective-C
- (void)setDidSyncSuccessfully;
Swift
func setDidSyncSuccessfully()
-
Sets the error and changes the
loadableState
to “failed” which triggers “did change” notification.Declaration
Objective-C
- (void)setDidFailToSyncWithError:(nullable NSError *)error;
Swift
func setDidFailToSyncWithError(_ error: (any Error)?)
-
Allows to force sending “did change” event from the outside or a subclass.
Declaration
Objective-C
- (void)notifyDidChange;
Swift
func notifyDidChange()
-
YES, if the object has at least one observer installed.
Declaration
Objective-C
@property (nonatomic, readonly) BOOL hasObservers;
Swift
var hasObservers: Bool { get }
-
@{ The counters allow to assert from the unit tests if certain methods were called.
Declaration
Objective-C
- (void)resetAllCallCounters;
Swift
func resetAllCallCounters()
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger syncIfNeededCounter
Swift
var syncIfNeededCounter: Int { get }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger syncCounter
Swift
var syncCounter: Int { get }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger isContentsAvailableCounter
Swift
var isContentsAvailableCounter: Int { get }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger addObserverCounter
Swift
var addObserverCounter: Int { get }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger removeObserverCounter
Swift
var removeObserverCounter: Int { get }
-
Subclasses can override to perform sync. Does nothing by default.
Declaration
Objective-C
- (void)doSync;
Swift
func doSync()