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 contentsAvailableSwift
var isContentsAvailable: Bool { get set } -
Undocumented
Declaration
Objective-C
@property (nonatomic, nullable) NSError *errorSwift
var error: (any Error)? { get set } -
@{ We allow to change
loadableStatedirectly 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
loadableStateto “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 syncIfNeededCounterSwift
var syncIfNeededCounter: Int { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger syncCounterSwift
var syncCounter: Int { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger isContentsAvailableCounterSwift
var isContentsAvailableCounter: Int { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger addObserverCounterSwift
var addObserverCounter: Int { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger removeObserverCounterSwift
var removeObserverCounter: Int { get } -
Subclasses can override to perform sync. Does nothing by default.
Declaration
Objective-C
- (void)doSync;Swift
func doSync()
View on GitHub
MMMTestLoadable Class Reference