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.
-
System fields.
Declaration
Swift
public let sys: Sys
-
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 thefields
dictionary.Declaration
Swift
public var fields: [FieldName : Any] { get }
-
Sets the locale on the Localizable Resource (i.e. an instance of
Asset
orEntry
) so that future reads from thefields
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 moreDeclaration
Swift
public enum CodingKeys : String, CodingKey
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public static func == (lhs: LocalizableResource, rhs: LocalizableResource) -> Bool