File tree Expand file tree Collapse file tree
KWVerificationCodeView/Classes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,14 +42,10 @@ protocol KWTextFieldDelegate: class {
4242
4343 @IBInspectable var textFont : String = " " {
4444 didSet {
45- if textFont . trim ( ) == " " {
46- numberTextField. font = UIFont . systemFont ( ofSize : textSize )
45+ if let font = UIFont ( name : textFont , size : textSize ) {
46+ numberTextField. font = font
4747 } else {
48- if let font = UIFont ( name: textFont, size: textSize) {
49- numberTextField. font = font
50- } else {
51- numberTextField. font = UIFont . systemFont ( ofSize: textSize)
52- }
48+ numberTextField. font = UIFont . systemFont ( ofSize: textSize)
5349 }
5450 }
5551 }
@@ -68,11 +64,8 @@ protocol KWTextFieldDelegate: class {
6864
6965 @IBInspectable var darkKeyboard : Bool = false {
7066 didSet {
71- if darkKeyboard {
72- numberTextField. keyboardAppearance = . dark
73- } else {
74- numberTextField. keyboardAppearance = . light
75- }
67+ keyboardAppearance = darkKeyboard ? . dark : . light
68+ numberTextField. keyboardAppearance = keyboardAppearance
7669 }
7770 }
7871
@@ -81,6 +74,7 @@ protocol KWTextFieldDelegate: class {
8174 @IBOutlet weak private var underlineView : UIView !
8275
8376 // MARK: - Variables
77+ private var keyboardAppearance = UIKeyboardAppearance . default
8478 weak var delegate : KWTextFieldDelegate ?
8579
8680 // MARK: - Lifecycle
Original file line number Diff line number Diff line change @@ -52,15 +52,12 @@ public protocol KWVerificationCodeViewDelegate: class {
5252
5353 @IBInspectable var textFont : String = " " {
5454 didSet {
55- if textFont. trim ( ) == " " {
56- textFieldFont = UIFont . systemFont ( ofSize : textSize )
55+ if let font = UIFont ( name : textFont. trim ( ) , size : textSize ) {
56+ textFieldFont = font
5757 } else {
58- if let font = UIFont ( name: textFont. trim ( ) , size: textSize) {
59- textFieldFont = font
60- } else {
61- textFieldFont = UIFont . systemFont ( ofSize: textSize)
62- }
58+ textFieldFont = UIFont . systemFont ( ofSize: textSize)
6359 }
60+
6461 for textFieldView in textFieldViews {
6562 textFieldView. numberTextField. font = textFieldFont
6663 }
You can’t perform that action at this time.
0 commit comments