artemkrachulov / AKMaskField

Swift plugin which allow add mask to input field

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash on method Refresh()

KaMagno opened this issue · comments

Original Code

    func refresh() {

        if maskObject.count > 0 && maskText != text {
            text = maskShowTemplate ? maskText : maskStatus == .Clear ? "" : maskText
        }

        // Reset manual updating property flag
        flagUpdateEvent = true
    }

The object maskObject was missing the Optional symbol(?) because it can be nil
Solution

    func refresh() {

        if maskObject?.count > 0 && maskText != text {
            text = maskShowTemplate ? maskText : maskStatus == .Clear ? "" : maskText
        }

        // Reset manual updating property flag
        flagUpdateEvent = true
    }

Hi, check new version, please