SPOfflineManager
Objective-C
@interface SPOfflineManager : NSObject
Swift
class SPOfflineManager : NSObject
The purpose of this class is to provide a simplified API for loading offline content bundled into the application. If your app needs to work offline immediately after installation or if your app is being used in areas where network connectivity is bad or non
-
Declaration
Objective-C
+ (nonnull instancetype)sharedInstance;
Swift
class func sharedInstance() -> Self
Return Value
Singleton instance of SPOfflineManager
-
Unavailable
call sharedInstance instead
unavailable methods, do not use these
Declaration
Objective-C
- (nonnull instancetype)init;
-
Loads bundled offline data. After data has been loaded, it’s cached and usable without an internet connection.
It’s recommended that you call this in your AppDelegate when the application starts.
Declaration
Objective-C
- (void)load:(nonnull NSString *)fileName completion:(nullable void (^)(BOOL))completionBlock;
Swift
func load(_ fileName: String, completion completionBlock: ((Bool) -> Void)? = nil)
Parameters
fileName
file name for offline bundle for example “offline_data-05-10-2017.sff”
completionBlock
called when offline data has been written into local caches
-
Downloads the latest offline bundle from Steerpath Web Services. Automatically starts using the data contained in the bundle.
Declaration
Objective-C
- (void)download:(nullable void (^)(BOOL))completionBlock;
Swift
func download(_ completionBlock: ((Bool) -> Void)? = nil)
Parameters
completionBlock
called when download has been done