Skip to content

Commit 16ee8b1

Browse files
committed
Documentation, pod
1 parent 21f3640 commit 16ee8b1

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

Diff for: KAPinField.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'KAPinField'
3-
s.version = '5.0.2'
3+
s.version = '5.0.3'
44
s.summary = 'Lightweight, highly customizable Pin Code Field library for iOS, written in Swift'
55
s.homepage = 'https://github.com/kirualex/KAPinField'
66
s.license = { :type => "MIT", :file => "LICENSE" }

Diff for: README.md

+30-24
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Don't forget to set the delegate likeso :
4646

4747
override func viewDidLoad() {
4848
super.viewDidLoad()
49-
pinField.properties.delegate = self
49+
properties.delegate = self
5050
...
5151
}
5252
```
@@ -63,37 +63,43 @@ extension MyController : KAPinFieldDelegate {
6363
### Properties
6464
All the logic properties are available in the `KAPinFieldProperties` struct named `properties`.
6565

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+
6668
##### Logic
6769
```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+
}
7680
```
7781

7882
##### Styling
7983
All the styling can be done via the `KAPinFieldAppearance` struct named `appearance`.
8084

8185
```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
88-
pinField.appearance.backColor = UIColor.clear
89-
pinField.appearance.backBorderWidth = 1
90-
pinField.appearance.backBorderColor = UIColor.white.withAlphaComponent(0.2)
91-
pinField.appearance.backCornerRadius = 4
92-
pinField.appearance.backFocusColor = UIColor.clear
93-
pinField.appearance.backBorderFocusColor = UIColor.white.withAlphaComponent(0.8)
94-
pinField.appearance.backActiveColor = UIColor.clear
95-
pinField.appearance.backBorderActiveColor = UIColor.white
96-
pinField.appearance.keyboardType = UIKeyboardType.numberPad // Specify keyboard type
86+
pinField.updateAppearence { appearance in
87+
appearance.font = .menloBold(40) // Default to appearance.MonospacedFont.menlo(40)
88+
appearance.kerning = 20 // Space between characters, default to 16
89+
appearance.textColor = UIColor.white.withAlphaComponent(1.0) // Default to nib color or black if initialized programmatically.
90+
appearance.tokenColor = UIColor.black.withAlphaComponent(0.3) // token color, default to text color
91+
appearance.tokenFocusColor = UIColor.black.withAlphaComponent(0.3) // token focus color, default to token color
92+
appearance.backOffset = 8 // Backviews spacing between each other
93+
appearance.backColor = UIColor.clear
94+
appearance.backBorderWidth = 1
95+
appearance.backBorderColor = UIColor.white.withAlphaComponent(0.2)
96+
appearance.backCornerRadius = 4
97+
appearance.backFocusColor = UIColor.clear
98+
appearance.backBorderFocusColor = UIColor.white.withAlphaComponent(0.8)
99+
appearance.backActiveColor = UIColor.clear
100+
appearance.backBorderActiveColor = UIColor.white
101+
appearance.keyboardType = UIKeyboardType.numberPad // Specify keyboard type
102+
}
97103
```
98104

99105
### Font

0 commit comments

Comments
 (0)