SyncEngine

open class SyncEngine: NSObject

SyncEngine is framework to Sync Data from Server. It syncs application’s Colors, Constants, Font Sizes/Styles and Texts/ Strings.

  • Holds Last Synced Server Data

    Declaration

    Swift

    open static var lastSyncedServerDate:String?
  • Static Initializer for Sync Engine.

    • Parameters:
      • urlToSync: Http request url for Sync data
      • authentication: Authentication Header if any

    Declaration

    Swift

    public static func initialize(_ urlToSync:String, authentication:[String:String]? = nil)

    Parameters

    urlToSync

    Http request url for Sync data

    authentication

    Authentication Header if any

  • Method to retrieve value for a given key of SyncEngine.

    Parameter

    Parameter aKey: key from SyncEngine

    Returns

    A generic value for a given key.

    Declaration

    Swift

    public class func objectForKey<T>(_ aKey: String?) -> T?

    Parameters

    aKey

    key from SyncEngine

    Return Value

    A generic value for a given key.

  • This method is used to sync an object with SyncEngine.

    • Parameters:
      • anObject: A SyncEngine object
      • aKey: A key of SyncEngine

    Declaration

    Swift

    public class func syncObject(_ anObject: AnyObject, forKey aKey: String)

    Parameters

    anObject

    A SyncEngine object

    aKey

    A key of SyncEngine

  • Sync Data from a Key value pair.

    Parameter

    Parameter dict: NSDictionary

    Returns

    Flag for success or failure.

    Declaration

    Swift

    @discardableResult public class func syncForData(_ dict:NSDictionary) -> Bool

    Parameters

    dict

    NSDictionary

    Return Value

    Flag for success or failure.

  • This static method should be called in applicationDidBecomeActive method of AppDelegate to sync data from Server.

    Declaration

    Swift

    public static func syncData()