Skip to content

Commit 4714b63

Browse files
committed
Update version for custom textfield
1 parent 7c9c275 commit 4714b63

4 files changed

Lines changed: 25 additions & 12 deletions

File tree

Sources/AsyncButton/AsyncButtonExecution.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import SwiftUI
1717
self.task?.cancel()
1818
self.task = Task { [weak self] in
1919
let loadingIndicatorTask = Task {
20-
try await Task.sleep(for: .seconds(1))
20+
try await Task.sleep(nanoseconds: 200_000_000)
2121
try Task.checkCancellation()
2222

2323
if !options.contains(.loadingIndicatorHidden) {

Sources/AsyncButton/Previews.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private struct PreviewButtonStyle: ButtonStyle {
2828
}
2929
}
3030

31+
@available(iOS 16.0, *)
3132
private struct PreviewView: View {
3233
var body: some View {
3334
NavigationStack {
@@ -78,7 +79,7 @@ private struct PreviewView: View {
7879
}
7980
}
8081

81-
@available(iOS 16.0, macOS 14.0, tvOS 16.0, watchOS 10.0, *)
82+
@available(iOS 17.0, macOS 14.0, tvOS 16.0, watchOS 10.0, *)
8283
#Preview(traits: .fixedLayout(width: 400, height: 400)) {
8384
PreviewView()
8485
}

Sources/CustomStepper/CustomStepper.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ private struct PreviewStepperStyle: CustomStepperStyle {
245245
Image(systemName: "plus")
246246
.imageScale(.large)
247247
.foregroundStyle(.purple)
248-
.bold()
249248
}
250249
}
251250

Sources/CustomTextField/CustomTextField.swift

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,26 @@ where Label: View, F: ParseableFormatStyle, F.FormatOutput == String {
8989
return AnyView(resolved)
9090
}
9191

92-
TextField(
93-
text: textBinding,
94-
prompt: prompt,
95-
axis: axis,
96-
label: { label }
97-
)
98-
.textFieldStyle(style)
99-
.focused($isFocused)
100-
.environment(\.customTextFieldParseError, error)
92+
if #available(iOS 16.0, *) {
93+
TextField(
94+
text: textBinding,
95+
prompt: prompt,
96+
axis: axis,
97+
label: { label }
98+
)
99+
.textFieldStyle(style)
100+
.focused($isFocused)
101+
.environment(\.customTextFieldParseError, error)
102+
} else {
103+
TextField(
104+
text: textBinding,
105+
prompt: prompt,
106+
label: { label }
107+
)
108+
.textFieldStyle(style)
109+
.focused($isFocused)
110+
.environment(\.customTextFieldParseError, error)
111+
}
101112
}
102113

103114
private func updateValue(_ value: String) {
@@ -191,6 +202,7 @@ private struct DemoTextFieldStyle: CustomTextFieldStyle {
191202
}
192203
}
193204

205+
@available(iOS 16.0, *)
194206
private struct PreviewView: View {
195207

196208
@State private var text = ""
@@ -218,6 +230,7 @@ private struct PreviewView: View {
218230
}
219231
}
220232

233+
@available(iOS 16.0, *)
221234
#Preview {
222235
PreviewView()
223236
.textFieldStyle(.plain)

0 commit comments

Comments
 (0)