Skip to content

Commit 4e9055a

Browse files
Merge pull request #9 from thisIsTheFoxe/dev
Dev
2 parents 6820625 + 07163f0 commit 4e9055a

7 files changed

Lines changed: 77 additions & 25 deletions

File tree

.swiftpm/xcode/xcshareddata/xcschemes/SimpleKeyboard.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1130"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

.swiftpm/xcode/xcshareddata/xcschemes/SimpleKeyboardTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1130"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/SimpleKeyboard/Views/KeyButton.swift

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ struct ShiftKeyButton: View {
2424

2525
var body: some View {
2626
Button(action: { self.isUpperCase?.toggle() }) {
27-
if #available(iOS 14, macOS 11, *) {
27+
if #available(iOS 15, macOS 12, *) {
28+
AnyView(Image(systemName: isUpperCase ? "shift.fill" : "shift")
29+
.dynamicTypeSize(.large))
30+
} else if #available(iOS 14, macOS 11, *) {
2831
AnyView(Image(systemName: isUpperCase ? "shift.fill" : "shift"))
2932
} else {
3033
AnyView(Text(isUpperCase! ? "Up": "lw", bundle: .module))
@@ -80,6 +83,7 @@ struct FRAccentKeyButton: View {
8083
.background(Color.black.opacity(0.4))
8184
.cornerRadius(5)
8285
.layoutPriority(10)
86+
.shadow(color: .black, radius: 0, y: 1)
8387
}
8488
}
8589

@@ -108,16 +112,26 @@ struct SpaceKeyButton: View, ClickableKey {
108112
@Binding var text: String
109113
@Environment(\.colorScheme) var colorScheme
110114

115+
var content: some View {
116+
let spaceText = Text("space", bundle: .module)
117+
if #available(iOS 15.0, macOS 12, *) {
118+
return AnyView(spaceText.dynamicTypeSize(.large))
119+
} else {
120+
return AnyView(spaceText)
121+
}
122+
}
123+
111124
var body: some View {
112125
Button(action: { self.text.append(" "); didClick() }) {
113-
Text("space", bundle: .module)
126+
content
114127
.padding()
128+
.frame(idealWidth: .infinity, maxWidth: .infinity)
115129
.frame(height: 50)
116130
.foregroundColor(.primary)
117-
.frame(maxWidth: .infinity)
118131
.background(colorScheme.keyboardKeyColor)
119132
.cornerRadius(7)
120133
.layoutPriority(2)
134+
.shadow(color: .black, radius: 1, y: 1)
121135
}
122136
}
123137
}
@@ -130,7 +144,9 @@ struct DeleteKeyButton: View {
130144
guard !self.text.isEmpty else { return }
131145
_ = self.text.removeLast()
132146
}) {
133-
if #available(iOS 14, macOS 11, *) {
147+
if #available(iOS 15, macOS 12, *) {
148+
AnyView(Image(systemName: "delete.left").dynamicTypeSize(.large))
149+
} else if #available(iOS 14, macOS 11, *) {
134150
AnyView(Image(systemName: "delete.left"))
135151
} else {
136152
AnyView(Text(""))
@@ -153,13 +169,24 @@ struct ActionKeyButton: View {
153169
@State var icon: Icon
154170
var action: () -> Void
155171

172+
var iconView: some View {
173+
if #available(iOS 15.0, macOS 12, *) {
174+
return AnyView(icon.view.dynamicTypeSize(.large))
175+
} else {
176+
return icon.view
177+
}
178+
}
179+
156180
var body: some View {
157181
Button(action: self.action) {
158-
icon.view.padding()
182+
iconView
183+
.padding()
184+
.frame(minWidth: 100, maxWidth: .infinity)
159185
.frame(height: 50)
160186
.foregroundColor(.white)
161-
.frame(minWidth: 100, idealWidth: .infinity, maxWidth: .infinity)
162-
.background(Color.blue).cornerRadius(7)
187+
.background(Color.blue)
188+
.cornerRadius(7)
189+
.shadow(color: .black, radius: 2, y: 2)
163190
}
164191
}
165192
}
@@ -171,11 +198,11 @@ public enum Icon {
171198
switch self {
172199
case .done: return AnyView(Text("Done!", bundle: .module))
173200
case .search:
174-
#if !targetEnvironment(macCatalyst)
175-
return AnyView(Text("Search", bundle: .module))
176-
#else
177-
return AnyView(Image(systemName: "magnifyingglass"))
178-
#endif
201+
if #available(iOS 14, macOS 11, *) {
202+
return AnyView(Image(systemName: "magnifyingglass"))
203+
}else {
204+
return AnyView(Text("Search", bundle: .module))
205+
}
179206
case .go: return AnyView(Text("Go!", bundle: .module))
180207
}
181208
}

Sources/SimpleKeyboard/Views/SimpleKeyboard.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct SimpleKeyboard_Previews: PreviewProvider {
6666
SimpleKeyboard(
6767
keys: [["a", "b", "c", "q", "w", "f", "m", "m"], ["d", "e", "f"]],
6868
textInput: .constant(""),
69-
theme: .floating)
69+
theme: .floating,
70+
actionButton: .go)
7071
}
7172
}
7273
// .preferredColorScheme(.dark)

Sources/SimpleKeyboard/Views/SimpleStandardKeyboard.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct SimpleStandardKeyboard: View, ThemeableView {
2424
HStack {
2525
if settings.showSpace {
2626
SpaceKeyButton(text: $settings.text)
27+
.layoutPriority(2)
2728
}
2829
if let actionIcon = settings.actionButton {
2930
ActionKeyButton(icon: actionIcon) {
@@ -108,6 +109,15 @@ struct SimpleStandardKeyboard_Previews: PreviewProvider {
108109
LinearGradient(colors: [.red, .green, .purple], startPoint: .bottomLeading, endPoint: .topTrailing)
109110
VStack {
110111
Spacer()
112+
SimpleStandardKeyboard(
113+
settings: KeyboardSettings(
114+
language: .english,
115+
textInput: nil,
116+
theme: .system,
117+
actionButton: .search,
118+
showNumbers: true,
119+
showSpace: true,
120+
isUpperCase: true))
111121
SimpleStandardKeyboard(
112122
settings: KeyboardSettings(
113123
language: .english,
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
"space" = "Leertaste";
1+
/* (No Comment) */
2+
"Done!" = "Fertig!";
23

3-
"Up" = "Gr";
4+
/* (No Comment) */
5+
"Go!" = "Los!";
46

7+
/* lower case */
58
"lw" = "kl";
69

7-
"Done!" = "Fertig!";
8-
10+
/* (No Comment) */
911
"Search" = "Suchen";
1012

11-
"Go!" = "Los!";
13+
/* (No Comment) */
14+
"space" = "Leertaste";
15+
16+
/* Upper Case */
17+
"Up" = "Gr";
18+
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
"space" = "espacio";
1+
/* (No Comment) */
2+
"Done!" = "¡Hecho!";
23

3-
"Up" = "Ma";
4+
/* (No Comment) */
5+
"Go!" = "ir";
46

7+
/* lower case */
58
"lw" = "mi";
69

7-
"Done!" = "¡Hecho!";
8-
10+
/* (No Comment) */
911
"Search" = "buscar";
1012

11-
"Go!" = "ir";
13+
/* (No Comment) */
14+
"space" = "espacio";
15+
16+
/* Upper Case */
17+
"Up" = "Ma";
18+

0 commit comments

Comments
 (0)