LocalizableResource

public class LocalizableResource : Resource, FlatResource, Codable
extension LocalizableResource: Hashable
extension LocalizableResource: Equatable

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 in moery. This class gives an interface to specify which locale should be used when reading content from Resource instances that are in memory.

  • sys

    System fields.

    Declaration

    Swift

    public let sys: Sys
  • The currently selected locale to use when reading data from the fields dictionary.

    Declaration

    Swift

    public var currentlySelectedLocale: Locale
  • The metadata linking to additional content like tags.

    Declaration

    Swift

    public var metadata: Metadata?
  • type of resource

    Declaration

    Swift

    public var type: ContentType?
  • The fields with content. 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] { get }
  • Sets 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

    Parameters

    code

    The string code for the Locale.

    Return Value

    false if the locale code doesn’t correspond to any locales in the space, true.

  • Declaration

    Swift

    public required init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • The keys used when representing a resource in JSON.

    See more

    Declaration

    Swift

    public enum CodingKeys : String, CodingKey

Internal