G8MaterialKitTextField icon indicating copy to clipboard operation
G8MaterialKitTextField copied to clipboard

Better way to assign type

Open khawars opened this issue 9 years ago • 2 comments

Hi @gali8. Thank you for great work :) This is not a bug, but I just wanted to describe my experience with this code. There should be a way to assign an Enum to regexPatternEnum instead of a number. Like: myTextField.regexPatternEnum = .Email

Currently, it is myTextField.regexPatternEnum = 9

which is not very descriptive.

Please add this feature in future version of this code.

khawars avatar Nov 26 '15 12:11 khawars

Hi there, I know. Unfortunatelly using the @IBInspectable property, you can't write enums into the storyboard (so a Int is required). Anyway, I will update the class so you can choice (programmatically) the right regexPatternEnum, using... enums :) like you suggest.

Last, you can obtain the same result using the regexPattern property and the rawValue of enums:

myTextField.regexPatternEnum = 0 //that's the default, you can ignore it. myTextField.regexPatternCustom = RegexPatternTypes.Email.rawValue

gali8 avatar Nov 27 '15 02:11 gali8

Thank you @gali8. I'll wait for the update. (y)

khawars avatar Nov 27 '15 11:11 khawars