TXNativeBuilder

public final class TXNativeBuilder : NSObject

Builder class for passing only the properties necessary for the SDK initialization based on the developer needs and initializing the SDK.

Example:

TXNativeBuilder()
    .setLocales(TXLocaleState(sourceLocale: "en",
                              appLocales: ["en"]))
    .setToken(token)
    .build()
  • Declaration

    Swift

    @objc
    public func setLocales(_ locales: TXLocaleState) -> TXNativeBuilder

    Parameters

    locales

    List of locale codes for the languages configured in the application.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setToken(_ token: String) -> TXNativeBuilder

    Parameters

    token

    API token to use for connecting to the CDS.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setSecret(_ secret: String) -> TXNativeBuilder

    Parameters

    secret

    Secret to use for pushing source content.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setCDSHost(_ cdsHost: String) -> TXNativeBuilder

    Parameters

    cdsHost

    Host for the Content Delivery Service.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setCustomAuthorizationHeaderKey(_ customAuthorizationHeaderKey: String) -> TXNativeBuilder

    Parameters

    customAuthorizationHeaderKey

    Value for the HTTP Header key used for passing the token and the secret to the cdsHost.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setSession(_ session: URLSession) -> TXNativeBuilder

    Parameters

    session

    URLSession to be used for all the requests made to the CDS service.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setFilterTags(_ filterTags: [String]) -> TXNativeBuilder

    Parameters

    filterTags

    List of tags so that only strings that have all of the given tags are fetched.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setFilterStatus(_ filterStatus: String) -> TXNativeBuilder

    Parameters

    filterStatus

    Status so that only strings matching translation status are fetched.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setCache(_ cache: TXCache) -> TXNativeBuilder

    Parameters

    cache

    Translation cache that holds the translations from the CDS.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setMissingPolicy(_ missingPolicy: TXMissingPolicy) -> TXNativeBuilder

    Parameters

    missingPolicy

    Policy to use for returning strings when a translation is missing.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setErrorPolicy(_ errorPolicy: TXErrorPolicy) -> TXNativeBuilder

    Parameters

    errorPolicy

    Policy to determine how to handle rendering errors.

    Return Value

    The builder instance

  • Declaration

    Swift

    @objc
    public func setRenderingStrategy(_ renderingStrategy: TXRenderingStategy) -> TXNativeBuilder

    Parameters

    renderingStrategy

    Strategy to be used when rendering the final string.

    Return Value

    The builder instance

  • Initializes the SDK based on the properties that were passed to the builder’s setter methods before hand.

    Declaration

    Swift

    @discardableResult
    @objc
    public func build() -> Bool

    Return Value

    True if the initialization was successful, false if either the locales or token properties are missing or if the SDK has been already initialized.