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) -> TXNativeBuilderParameters
localesList of locale codes for the languages configured in the application.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setToken(_ token: String) -> TXNativeBuilderParameters
tokenAPI token to use for connecting to the CDS.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setSecret(_ secret: String) -> TXNativeBuilderParameters
secretSecret to use for pushing source content.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setCDSHost(_ cdsHost: String) -> TXNativeBuilderParameters
cdsHostHost for the Content Delivery Service.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setCustomAuthorizationHeaderKey(_ customAuthorizationHeaderKey: String) -> TXNativeBuilderParameters
customAuthorizationHeaderKeyValue for the HTTP Header key used for passing the
tokenand thesecretto thecdsHost.Return Value
The builder instance
-
Declaration
Swift
@objc public func setSession(_ session: URLSession) -> TXNativeBuilderParameters
sessionURLSession 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]) -> TXNativeBuilderParameters
filterTagsList 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) -> TXNativeBuilderParameters
filterStatusStatus so that only strings matching translation status are fetched.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setCache(_ cache: TXCache) -> TXNativeBuilderParameters
cacheTranslation cache that holds the translations from the CDS.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setMissingPolicy(_ missingPolicy: TXMissingPolicy) -> TXNativeBuilderParameters
missingPolicyPolicy to use for returning strings when a translation is missing.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setErrorPolicy(_ errorPolicy: TXErrorPolicy) -> TXNativeBuilderParameters
errorPolicyPolicy to determine how to handle rendering errors.
Return Value
The builder instance
-
Declaration
Swift
@objc public func setRenderingStrategy(_ renderingStrategy: TXRenderingStategy) -> TXNativeBuilderParameters
renderingStrategyStrategy 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() -> BoolReturn Value
True if the initialization was successful, false if either the
localesortokenproperties are missing or if the SDK has been already initialized.
View on GitHub