Skip to content

Commit 6ea3319

Browse files
authored
Merge pull request #32 from cemolcay/feature/cemolcay-layout
Add CustomKeyboardLayoutStyle
2 parents 30979c3 + 0a00821 commit 6ea3319

File tree

4 files changed

+269
-246
lines changed

4 files changed

+269
-246
lines changed

Keyboard/DefaultKeyboard/CustomKeyboard.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ import UIKit
2020

2121
// MARK: - CustomKeyboard
2222
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+
}
2529

2630
// MARK: CustomKeyobardShiftState
2731
public enum CustomKeyboardShiftState {
@@ -73,6 +77,8 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
7377
}
7478
}
7579

80+
public weak var delegate: CustomKeyboardDelegate?
81+
7682
// MARK: Init
7783
public init() {
7884
super.init(frame: CGRect.zero)
@@ -90,6 +96,7 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
9096
}
9197

9298
private func defaultInit() {
99+
keyboardLayoutStyleDidChange()
93100
keyboardLayoutStateDidChange(oldState: nil, newState: keyboardLayoutState)
94101
}
95102

@@ -127,6 +134,10 @@ public class CustomKeyboard: UIView, KeyboardLayoutDelegate {
127134
return getKeyboardLayout(ofState: keyboardLayoutState)
128135
}
129136

137+
public func keyboardLayoutStyleDidChange() {
138+
keyboardLayout = CustomKeyboardLayout(style: keyboardStyle)
139+
}
140+
130141
public func keyboardLayoutStateDidChange(oldState oldState: CustomKeyboardLayoutState?, newState: CustomKeyboardLayoutState) {
131142
// Remove old keyboard layout
132143
if let oldState = oldState {

0 commit comments

Comments
 (0)