@@ -20,8 +20,12 @@ import UIKit
20
20
21
21
// MARK: - CustomKeyboard
22
22
public class CustomKeyboard: UIView , KeyboardLayoutDelegate {
23
- public var keyboardLayout = CustomKeyboardLayout ( )
24
- public weak var delegate : CustomKeyboardDelegate ?
23
+ public var keyboardLayout : CustomKeyboardLayout !
24
+ public var keyboardStyle = CustomKeyboardLayoutStyle ( ) {
25
+ didSet {
26
+ keyboardLayoutStyleDidChange ( )
27
+ }
28
+ }
25
29
26
30
// MARK: CustomKeyobardShiftState
27
31
public enum CustomKeyboardShiftState {
@@ -73,6 +77,8 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
73
77
}
74
78
}
75
79
80
+ public weak var delegate : CustomKeyboardDelegate ?
81
+
76
82
// MARK: Init
77
83
public init ( ) {
78
84
super. init ( frame: CGRect . zero)
@@ -90,6 +96,7 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
90
96
}
91
97
92
98
private func defaultInit( ) {
99
+ keyboardLayoutStyleDidChange ( )
93
100
keyboardLayoutStateDidChange ( oldState: nil , newState: keyboardLayoutState)
94
101
}
95
102
@@ -127,6 +134,10 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
127
134
return getKeyboardLayout ( ofState: keyboardLayoutState)
128
135
}
129
136
137
+ public func keyboardLayoutStyleDidChange( ) {
138
+ keyboardLayout = CustomKeyboardLayout ( style: keyboardStyle)
139
+ }
140
+
130
141
public func keyboardLayoutStateDidChange( oldState oldState: CustomKeyboardLayoutState ? , newState: CustomKeyboardLayoutState ) {
131
142
// Remove old keyboard layout
132
143
if let oldState = oldState {
0 commit comments