Skip to content

Commit 1290188

Browse files
Merge pull request #22 from componentskit/demos-min-deployment-version
Set demo app min deployment version to iOS 15
2 parents f6f2f65 + e7fd3dd commit 1290188

File tree

10 files changed

+125
-23
lines changed

10 files changed

+125
-23
lines changed

Examples/DemosApp/DemosApp.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,9 @@
265265
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
266266
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
267267
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
268-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
269-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
268+
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
269+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
270+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
270271
LD_RUNPATH_SEARCH_PATHS = (
271272
"$(inherited)",
272273
"@executable_path/Frameworks",
@@ -292,8 +293,9 @@
292293
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
293294
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
294295
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
295-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
296-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
296+
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
297+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
298+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
297299
LD_RUNPATH_SEARCH_PATHS = (
298300
"$(inherited)",
299301
"@executable_path/Frameworks",
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 = "1610"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "740D22262CD3BECA006731A5"
19+
BuildableName = "DemosApp.app"
20+
BlueprintName = "DemosApp"
21+
ReferencedContainer = "container:DemosApp.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
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 = "740D22262CD3BECA006731A5"
48+
BuildableName = "DemosApp.app"
49+
BlueprintName = "DemosApp"
50+
ReferencedContainer = "container:DemosApp.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 = "740D22262CD3BECA006731A5"
65+
BuildableName = "DemosApp.app"
66+
BlueprintName = "DemosApp"
67+
ReferencedContainer = "container:DemosApp.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>

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/InputFieldPreview.swift

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ struct InputFieldPreview: View {
1111
@State private var text: String = ""
1212
@FocusState private var isFocused: Bool
1313

14-
private let inputField = UKInputField()
15-
private let inputFieldDelegate = InputFieldDelegate()
14+
@ObservedObject private var inputField = PreviewInputField()
1615

1716
var body: some View {
1817
VStack {
@@ -64,12 +63,9 @@ struct InputFieldPreview: View {
6463
))
6564
}
6665
}
67-
.onAppear {
68-
self.inputField.textField.delegate = self.inputFieldDelegate
69-
}
7066
.toolbar {
7167
ToolbarItem(placement: .primaryAction) {
72-
if (self.inputFieldDelegate.isEditing || self.isFocused) && !ProcessInfo.processInfo.isiOSAppOnMac {
68+
if (self.inputField.isEditing || self.isFocused) && !ProcessInfo.processInfo.isiOSAppOnMac {
7369
Button("Hide Keyboard") {
7470
self.isFocused = false
7571
self.inputField.resignFirstResponder()
@@ -80,9 +76,22 @@ struct InputFieldPreview: View {
8076
}
8177
}
8278

83-
@Observable
84-
private final class InputFieldDelegate: NSObject, UITextFieldDelegate {
85-
var isEditing: Bool = false
79+
private final class PreviewInputField: UKInputField, ObservableObject, UITextFieldDelegate {
80+
@Published var isEditing: Bool = false
81+
82+
override init(
83+
initialText: String = "",
84+
model: InputFieldVM = .init(),
85+
onValueChange: @escaping (String) -> Void = { _ in }
86+
) {
87+
super.init(initialText: initialText, model: model, onValueChange: onValueChange)
88+
89+
self.textField.delegate = self
90+
}
91+
92+
required init?(coder: NSCoder) {
93+
fatalError("init(coder:) has not been implemented")
94+
}
8695

8796
func textFieldDidBeginEditing(_ textField: UITextField) {
8897
self.isEditing = true

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/TextInputPreview.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct TextInputPreviewPreview: View {
1313
@State private var text: String = ""
1414
@FocusState private var isFocused: Bool
1515

16-
private let textInput = PreviewTextInput()
16+
@ObservedObject private var textInput = PreviewTextInput()
1717

1818
var body: some View {
1919
VStack {
@@ -77,9 +77,8 @@ struct TextInputPreviewPreview: View {
7777
}
7878
}
7979

80-
@Observable
81-
private final class PreviewTextInput: UKTextInput {
82-
var isEditing: Bool = false
80+
private final class PreviewTextInput: UKTextInput, ObservableObject {
81+
@Published var isEditing: Bool = false
8382

8483
func textViewDidBeginEditing(_ textView: UITextView) {
8584
self.isEditing = true

Examples/DemosApp/DemosApp/Core/App.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SwiftUI
33

44
struct App: View {
55
var body: some View {
6-
NavigationStack {
6+
NavigationView {
77
List {
88
Section("Components") {
99
NavigationLinkWithTitle("Button") {
@@ -27,10 +27,10 @@ struct App: View {
2727
}
2828

2929
Section("Login Demo") {
30-
NavigationLink("SwiftUI") {
30+
NavigationLinkWithTitle("SwiftUI") {
3131
SwiftUILogin()
3232
}
33-
NavigationLink("UIKit") {
33+
NavigationLinkWithTitle("UIKit") {
3434
UIViewControllerRepresenting {
3535
UIKitLogin()
3636
}

Examples/DemosApp/DemosApp/Demos/Login/SwiftUILogin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct SwiftUILogin: View {
147147
}
148148
}
149149
.frame(maxWidth: 500)
150-
.onChange(of: self.selectedPage) { _, newValue in
150+
.onChange(of: self.selectedPage) { newValue in
151151
if newValue == .signIn,
152152
self.focusedInput == .name || self.focusedInput == .bio {
153153
self.focusedInput = .email

Examples/DemosApp/DemosApp/Demos/Login/UIKitLogin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ final class UIKitLogin: UIViewController {
115115
self.stackView.addArrangedSubview(self.consentCheckbox)
116116
self.stackView.addArrangedSubview(self.continueButton)
117117

118-
self.pageControl.onSelectionChange = { [weak self] selectedPage in
118+
self.pageControl.onSelectionChange = { [weak self] _ in
119119
guard let self else { return }
120120

121121
self.dismissKeyboard()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import UIKit
2+
3+
extension UIView {
4+
/// Whether the view is visible.
5+
var isVisible: Bool {
6+
return !self.isHidden
7+
}
8+
}

Sources/ComponentsKit/Loading/SULoading.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public struct SULoading: View {
5454
alignment: .center
5555
)
5656
.onAppear {
57-
self.rotationAngle = 2 * .pi
57+
DispatchQueue.main.async {
58+
self.rotationAngle = 2 * .pi
59+
}
5860
}
5961
}
6062
}

Sources/ComponentsKit/Loading/UKLoading.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ open class UKLoading: UIView, UKComponent {
135135
// Adjust the layer's frame to fit within the view's bounds
136136
self.shapeLayer.frame = self.bounds
137137
self.updateShapePath()
138+
139+
if self.isVisible {
140+
self.addSpinnerAnimation()
141+
}
138142
}
139143

140144
// MARK: UIView methods

0 commit comments

Comments
 (0)