Localize-Swift icon indicating copy to clipboard operation
Localize-Swift copied to clipboard

Part of the UI control localizeKey is missing.

Open CainLuo opened this issue 5 years ago • 2 comments

// MARK: UITextField
@IBDesignable public extension UITextField {
    @IBInspectable var placeholderLocalizeKey: String {
        set {
            DispatchQueue.main.async {
                self.placeholder = newValue.localized()
            }
        }
        get {
            return self.placeholderLocalizeKey.localized()
        }
    }
}

// MARK: UIBarButtonItem
@IBDesignable public extension UIBarButtonItem {
    @IBInspectable var localizeKey: String {
        set {
            DispatchQueue.main.async {
                self.title = newValue.localized()
            }
        }
        get {
            return self.localizeKey.localized()
        }
    }
}

Part of the UI control localizeKey is missing, the code is above, can we add it in the next version?

And is there something unreasonable about the localizeKey setting of the UIButton? For example, I need to set the localizeKey for UIButton's highlighted state, which is not provided.

CainLuo avatar Nov 25 '20 02:11 CainLuo

// MARK: UIBarButtonItem
@IBDesignable public extension UIViewController {
    @IBInspectable var localizeKey: String {
        set {
            DispatchQueue.main.async {
                self.title = newValue.localized()
            }
        }
        get {
            return self.localizeKey.localized()
        }
    }
}

CainLuo avatar Nov 30 '20 07:11 CainLuo

@marmelroy

CainLuo avatar Nov 30 '20 07:11 CainLuo