You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the logic properties are available in the `KAPinFieldProperties` struct named `properties`.
65
65
66
+
** Token can't be a whitespace due to Apple handling of trailing spaces. You can achieve the same effect using any token with `tokenColor` and `tokenFocusColor` set to `.clear`**
67
+
66
68
##### Logic
67
69
```swift
68
-
pinField.properties.token="-"// Default to "•"
69
-
pinField.properties.numberOfCharacters=5// Default to 4
70
-
pinField.properties.validCharacters="0123456789+#?"// Default to only numbers, "0123456789"
71
-
pinField.properties.text="123"// You can set part or all of the text
72
-
pinField.properties.animateFocus=true// Animate the currently focused token
73
-
pinField.properties.isSecure=false// Secure pinField will hide actual input
74
-
pinField.properties.secureToken="*"// Token used to hide actual character input when using isSecure = true
75
-
pinField.properties.isUppercased=false// You can set this to convert input to uppercased.
70
+
pinField.updateProperties { properties in
71
+
properties.token="-"// Default to "•", can't be a whitespace !
72
+
properties.numberOfCharacters=5// Default to 4
73
+
properties.validCharacters="0123456789+#?"// Default to only numbers, "0123456789"
74
+
properties.text="123"// You can set part or all of the text
75
+
properties.animateFocus=true// Animate the currently focused token
76
+
properties.isSecure=false// Secure pinField will hide actual input
77
+
properties.secureToken="*"// Token used to hide actual character input when using isSecure = true
78
+
properties.isUppercased=false// You can set this to convert input to uppercased.
79
+
}
76
80
```
77
81
78
82
##### Styling
79
83
All the styling can be done via the `KAPinFieldAppearance` struct named `appearance`.
80
84
81
85
```swift
82
-
pinField.appearance.font= .menloBold(40) // Default to appearance.MonospacedFont.menlo(40)
83
-
pinField.appearance.kerning=20// Space between characters, default to 16
84
-
pinField.appearance.textColor= UIColor.white.withAlphaComponent(1.0) // Default to nib color or black if initialized programmatically.
85
-
pinField.appearance.tokenColor= UIColor.black.withAlphaComponent(0.3) // token color, default to text color
86
-
pinField.appearance.tokenFocusColor= UIColor.black.withAlphaComponent(0.3) // token focus color, default to token color
87
-
pinField.appearance.backOffset=8// Backviews spacing between each other
0 commit comments