TKMServiceFactoryBuilder

@objc(TKMServiceFactoryBuilder)
public class TKMServiceFactoryBuilder : NSObject

This class is used to build a TKMServiceFactory.

The example below illustrates a default use of this class and will cover most use cases:

 let b = TKMServiceFactoryBuilder()
 let tapkeyServiceFactory = b.build()

See also

TKMServiceFactory
  • Overrides the internal server clock used by various components of the SDK. If applications require access to the server clock, they must use this method to override the SDK’s internal server clock and keep hold of the reference for later use.

    Declaration

    Swift

    @objc
    public func setServerClock(_ serverClock: TKMServerClock) -> TKMServiceFactoryBuilder

    Return Value

    the TKMServiceFactoryBuilder instance for chaining.

  • Overrides the default Tapkey environment configuration with the specified one. Must only be used if suggested by Tapkey.

    Declaration

    Swift

    @objc
    public func setConfig(_ config: TKMEnvironmentConfig) -> TKMServiceFactoryBuilder

    Return Value

    the TKMServiceFactoryBuilder instance for chaining.

  • Reserved for internal use.

    Declaration

    Swift

    @objc
    public func setAnalyticsManager(_ analyticsManger: NetTpkyMcManagerAnalyticsManagerProtocol) -> TKMServiceFactoryBuilder
  • Reserved for internal use.

    Declaration

    Swift

    @objc
    public func setHttpRequestExecutor(_ httpRequestExecutor: NetTpkyMcRestAsyncHttpRequestExecutor) -> TKMServiceFactoryBuilder
  • Reserved for internal use.

    Declaration

    Swift

    @objc
    public func setWebsocketFactory(_ webSocketFactory: NetTpkyMcRelayWebSocketFactory) -> TKMServiceFactoryBuilder
  • Sets the application’s token refresh handler. The SDK will call this handler to request renewal of access tokens.

    @see TokenRefreshHandler

    Declaration

    Swift

    public func setTokenRefreshHandler(_ tokenRefreshHandler: TKMTokenRefreshHandler) -> TKMServiceFactoryBuilder

    Return Value

    the TKMServiceFactoryBuilder instance for chaining.

  • Reserved for internal use.

    Declaration

    Swift

    public func setCloudMessagingManager(_ cloudMessagingManager: TKMCloudMessagingManager) -> TKMServiceFactoryBuilder
  • Reserved for internal use.

    Declaration

    Swift

    public func setDataContextMigrationListener(_ dataContextMigrationListener: TKMDataContextMigrationListener) -> TKMServiceFactoryBuilder
  • Reserved for internal use.

    Declaration

    Swift

    public func setDataContextMigrationListeners(_ dataContextMigrationListeners: TKMDataContextMigrationListener...) -> TKMServiceFactoryBuilder
  • Sets the application group id to share Tapkey data between apps and extensions.

    App groups is an iOS API feature to share data between explicitly defined apps and extensions. Before using it, it must be configured according to the Apple documentation.

    Data migration

    When no app group has been used yet or a different app group should be used, data can be automatically migrated. To enable migration set migrateData to true.

    Warning

    This is only safe to use from a single application of app group. When multiple apps use data migration, it will cause data loss or inconsistent data!

    Data migration between different app groups

    To move data from an app group to a different app group the parameter fromAppGroupId can be used. When fromAppGroupId is not set or set to nil, data will be moved from the app container.

    Warning

    App must have access to both app groups for data migration

    Warning

    Data can only be migrated between given groups. When the app group has changed more than once and the app did not recognize each migration, data will be lost. Be sure about these consequences when migrating the app group.

    Data migration back to app container

    To move data from app group back to app container, the parameter appGroupId must be set nil and the fromAppGroupId must be set to the app group, where the data was stored before.

    Warning

    Data can only be migrated between given groups. When the app group has changed more than once and the app did not recognize each migration, data will be lost. Be sure about these consequences when migrating the app group.

    Important

    Use data migration with care. It might cause data loss or inconsistent data!

    Declaration

    Swift

    @objc
    public func setAppGroup(appGroupId: String?, migrateData: Bool = false, fromAppGroupId: String? = nil) -> TKMServiceFactoryBuilder

    Parameters

    appGroupId

    Id of app group, where data should be stored. Nil will save data inside app container.

    migrateData

    True if existing data should be moved

    fromAppGroupId

    Id of app group, where data should be loaded. Nil or not setting this will move data from app container

    Return Value

    TapkeyServiceFactoryBuilder for chaining

  • Undocumented

    Declaration

    Swift

    public func build() -> TKMServiceFactory