L10n

@propertyWrapper
struct L10n

This property wrapper is designed to provide an easy way to create internationalized Strings for use in component design. Place the @L10n property wrapper in front of the variable creation and the value of the String should be the key desired from the strings files.

@L10n var iWelcome: String = "WELCOME_MESSAGE"

// iWelcomeMessage would now appear as the translation string

Note

This can only be used on class or maybe struct properties, it cannot be used on local variables yet as of Swift 5
  • Takes the value this string is assigned to and converts it on assignment to the translation equal to the associated strings file.

    Declaration

    Swift

    init(wrappedValue value: String, language: String? = nil, _ comment: String = "")
  • Retrieves the translated value

    Declaration

    Swift

    var wrappedValue: String { get }