Skip to content

Instantly share code, notes, and snippets.

@dimpiax
Created April 27, 2020 20:26
Show Gist options
  • Save dimpiax/ec466914c84fbdddc539365a5030bace to your computer and use it in GitHub Desktop.
Save dimpiax/ec466914c84fbdddc539365a5030bace to your computer and use it in GitHub Desktop.

Revisions

  1. dimpiax created this gist Apr 27, 2020.
    14 changes: 14 additions & 0 deletions Localized.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    @propertyWrapper
    struct Localized<T: Localizable> {
    private let key: LocalizationKey

    var wrappedValue: T? = nil {
    didSet {
    wrappedValue?.set(localization: key)
    }
    }

    init(_ key: LocalizationKey) {
    self.key = key
    }
    }