Skip to content

Commit 0ec7cad

Browse files
authored
Merge pull request #7 from aaronLab/feature/shouldReturn
Add shouldReturn
2 parents b51445b + 58a1601 commit 0ec7cad

7 files changed

Lines changed: 312 additions & 148 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1230"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "A4C784C2258B91B7009BB00C"
18+
BuildableName = "Example.app"
19+
BlueprintName = "Example"
20+
ReferencedContainer = "container:Example.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = ""
36+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "A4C784C2258B91B7009BB00C"
48+
BuildableName = "Example.app"
49+
BlueprintName = "Example"
50+
ReferencedContainer = "container:Example.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "A4C784C2258B91B7009BB00C"
65+
BuildableName = "Example.app"
66+
BlueprintName = "Example"
67+
ReferencedContainer = "container:Example.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

Example/Example/ContentView.swift

Lines changed: 75 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,78 +19,90 @@ struct ContentView: View {
1919
// MARK: - BODY
2020

2121
var body: some View {
22-
VStack(alignment: .leading, spacing: 30) {
22+
23+
ScrollView(showsIndicators: false) {
2324

24-
// Default
25-
Group {
26-
Text("Default")
27-
.font(.system(size: 14, weight: .bold, design: .default))
28-
RespondableTextField(text: $text1, tag: 0, isFirstResponder: true, placeholder: "1st") { value in
29-
print("onEditing: \(value)")
30-
} didBeginEditing: {
31-
print("didBeginEditing")
32-
} didEndEditing: {
33-
print("didEndEditing")
25+
VStack(alignment: .leading, spacing: 30) {
26+
27+
// Default
28+
Group {
29+
Text("Default")
30+
.font(.system(size: 14, weight: .bold, design: .default))
31+
RespondableTextField(text: $text1, tag: 0, isFirstResponder: true, placeholder: "1st") { value in
32+
print("onEditing: \(value)")
33+
} didBeginEditing: {
34+
print("didBeginEditing")
35+
} didEndEditing: {
36+
print("didEndEditing")
37+
} shouldReturn: { value in
38+
print("shouldReturn: \(value ?? "N/A")")
39+
}
40+
41+
Text(text1)
3442
}
3543

36-
Text(text1)
37-
}
38-
39-
// SecureType + RectangleLine Border
40-
Group {
41-
Text("SecureType + RectangleLine Border")
42-
.font(.system(size: 14, weight: .bold, design: .default))
43-
RespondableTextField(text: $text2, tag: 1, placeholder: "2nd") { value in
44-
print("onEditing: \(value)")
45-
} didBeginEditing: {
46-
print("didBeginEditing")
47-
} didEndEditing: {
48-
print("didEndEditing")
44+
// SecureType + RectangleLine Border
45+
Group {
46+
Text("SecureType + RectangleLine Border")
47+
.font(.system(size: 14, weight: .bold, design: .default))
48+
RespondableTextField(text: $text2, tag: 1, placeholder: "2nd") { value in
49+
print("onEditing: \(value)")
50+
} didBeginEditing: {
51+
print("didBeginEditing")
52+
} didEndEditing: {
53+
print("didEndEditing")
54+
} shouldReturn: { value in
55+
print("shouldReturn: \(value ?? "N/A")")
56+
}
57+
.respondableSecureType()
58+
.respondableLineStyle()
59+
60+
Text(text2)
4961
}
50-
.respondableSecureType()
51-
.respondableLineStyle()
5262

53-
Text(text2)
54-
}
55-
56-
// NumberPad + OneTimeCode + Rounded Border
57-
Group {
58-
Text("NumberPad + OneTimeCode + Rounded Border")
59-
.font(.system(size: 14, weight: .bold, design: .default))
60-
RespondableTextField(text: $text3, tag: 2, placeholder: "3rd") { value in
61-
print("onEditing: \(value)")
62-
} didBeginEditing: {
63-
print("didBeginEditing")
64-
} didEndEditing: {
65-
print("didEndEditing")
63+
// NumberPad + OneTimeCode + Rounded Border
64+
Group {
65+
Text("NumberPad + OneTimeCode + Rounded Border")
66+
.font(.system(size: 14, weight: .bold, design: .default))
67+
RespondableTextField(text: $text3, tag: 2, placeholder: "3rd") { value in
68+
print("onEditing: \(value)")
69+
} didBeginEditing: {
70+
print("didBeginEditing")
71+
} didEndEditing: {
72+
print("didEndEditing")
73+
} shouldReturn: { value in
74+
print("shouldReturn: \(value ?? "N/A")")
75+
}
76+
.respondableKeyboardType(.numberPad)
77+
.respondableContentType(.oneTimeCode)
78+
.textFieldStyle(RoundedBorderTextFieldStyle())
79+
80+
Text(text3)
6681
}
67-
.respondableKeyboardType(.numberPad)
68-
.respondableContentType(.oneTimeCode)
69-
.textFieldStyle(RoundedBorderTextFieldStyle())
7082

71-
Text(text3)
72-
}
73-
74-
// didEndEditing + Bazel Border + Font
75-
Group {
76-
Text("didBeginEditing + didEndEditing + Bazel Border")
77-
.font(.system(size: 14, weight: .bold, design: .default))
78-
RespondableTextField(text: $text4, tag: 3, placeholder: "4th") { value in
79-
print("onEditing: \(value)")
80-
} didBeginEditing: {
81-
print("didBeginEditing")
82-
} didEndEditing: {
83-
print("didEndEditing")
83+
// didEndEditing + Bazel Border + Font
84+
Group {
85+
Text("didBeginEditing + didEndEditing + Bazel Border")
86+
.font(.system(size: 14, weight: .bold, design: .default))
87+
RespondableTextField(text: $text4, tag: 3, placeholder: "4th") { value in
88+
print("onEditing: \(value)")
89+
} didBeginEditing: {
90+
print("didBeginEditing")
91+
} didEndEditing: {
92+
print("didEndEditing")
93+
} shouldReturn: { value in
94+
print("shouldReturn: \(value ?? "N/A")")
95+
}
96+
.respondableBezelStyle()
97+
.respondableFont(.systemFont(ofSize: 20, weight: .bold))
98+
99+
Text(text4)
84100
}
85-
.respondableBezelStyle()
86-
.respondableFont(.systemFont(ofSize: 20, weight: .bold))
87101

88-
Text(text4)
89-
}
90-
91-
} //: V
92-
.padding()
93-
102+
} //: V
103+
.padding()
104+
} //: S
105+
.preferredColorScheme(.light)
94106
}
95107
}
96108

0 commit comments

Comments
 (0)