Eureka: Can't add RuleMinLength rule into IntRow

Created on 27 Oct 2016  路  4Comments  路  Source: xmartlabs/Eureka

I'm using carthage build from master branch, and when trying to add this rule to the row, it shows follow error

Incorrect argument label in call (have 'rule:', expected 'ruleSet:')
            <<< IntRow("cvv") { row in
                row.title = "Verification Code"
                row.placeholder = "CVV"
                row.add(rule: RuleRequired())
                row.add(rule: RuleMinLength(minLength: 3))
            }

And everything is fine in any other row

Using Xcode 8.1

Validations

Most helpful comment

Hey @dev4dev
RuleMinLength can only be used for String values. In your case you have a Int value so you should use RuleGreaterOrEqualThan(100)

All 4 comments

Hey @dev4dev
RuleMinLength can only be used for String values. In your case you have a Int value so you should use RuleGreaterOrEqualThan(100)

CVVs can begin with "0", this rule will invalidate 1/10 from all card owners :)

In that case I would recommend you to use a TextRow then set up the keyboard to show only numeric digits and finally use RuleMinLength rule. It will work since TextRow holds a String value.

Alternatively you can use https://github.com/EurekaCommunity/CreditCardRow which is a custom row to enter credit cards.

@mspasov yep, that's why I switched back to TextRow =)

Was this page helpful?
0 / 5 - 0 ratings