LocalizableResource

public class LocalizableResource: Resource

LocalizableResource

Base class for any Resource that has the capability of carrying information for multiple locales. If more than one locale is fetched using either /sync endpoint, or specifying the wildcard value for the locale paramater (i.e [locale: *]) during a fetch, the SDK will cache returned values for all locales. This class gives an interface to specify which locale should be used when fetching data from Resource instances that are in memory.

  • Currently selected locale to use when reading data from the fields dictionary.

    Declaration

    Swift

    public var currentlySelectedLocale: Locale
  • Content fields. If there is no value for a field associated with the currently selected Locale, the SDK will walk down fallback chain until a value is found. If there is still no value after walking the full chain, the field will be omitted from the fields dictionary.

    Declaration

    Swift

    public var fields: [FieldName: Any]
  • Set’s the locale on the Localizable Resource (i.e. an instance of Asset or Entry) so that future reads from the fields property will return data corresponding to the specified locale code.

    Declaration

    Swift

    @discardableResult public func setLocale(withCode code: LocaleCode) -> Bool