Skip to content

Commit

Permalink
Clean Xcode 16 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinneko committed Sep 10, 2024
1 parent 3725d99 commit 7168c65
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1300;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1600;
TargetAttributes = {
24651B2A27043658005AD842 = {
CreatedOnToolsVersion = 13.0;
Expand Down Expand Up @@ -419,6 +419,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = DebugMaxDeploymentTarget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
63 changes: 35 additions & 28 deletions Sources/CharcoalSwiftUI/Components/CharcoalTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,42 @@ public extension View {
}

@available(iOS 15, *)
#Preview {
struct CharcoalTextFieldPreview: View {
@State var text1 = ""
@State var text2 = ""

return VStack(spacing: 16) {
TextField("Simple text field", text: $text1)
.charcoalTextField()
TextField("Placeholder", text: $text2)
.charcoalTextField(
label: .constant("Label"),
countLabel: .init(
get: { "\(text2.count)/10" },
set: { _ in }
),
assistiveText: .init(
get: { text2.count > 10 ? "Error" : "OK" },
set: { _ in }
),
hasError: .init(
get: { text2.count > 10 },
set: { _ in }

var body: some View {
VStack(spacing: 16) {
TextField("Simple text field", text: $text1)
.charcoalTextField()
TextField("Placeholder", text: $text2)
.charcoalTextField(
label: .constant("Label"),
countLabel: .init(
get: { "\(text2.count)/10" },
set: { _ in }
),
assistiveText: .init(
get: { text2.count > 10 ? "Error" : "OK" },
set: { _ in }
),
hasError: .init(
get: { text2.count > 10 },
set: { _ in }
)
)
)
TextField("", text: .constant("Text"))
.disabled(true)
.charcoalTextField(
label: .constant("Label"),
countLabel: .constant("0/10"),
assistiveText: .constant("Assistive text")
)
}.padding()
TextField("", text: .constant("Text"))
.disabled(true)
.charcoalTextField(
label: .constant("Label"),
countLabel: .constant("0/10"),
assistiveText: .constant("Assistive text")
)
}.padding()
}
}

@available(iOS 15, *)
#Preview {
CharcoalTextFieldPreview()
}
77 changes: 42 additions & 35 deletions Sources/CharcoalSwiftUI/Modal/CharcoalModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,46 +215,53 @@ public extension View {
}

@available(iOS 17, *)
#Preview {
struct CharcoalModalViewPreview: View {
@State var isPresented = true
@State var text1: String = ""

var body: some View {
ZStack {
Button(action: {
isPresented = true
}, label: {
Text("Show")
.padding()
})
.charcoalModal(
title: "Title",
style: .center,
isPresented: $isPresented,
actions: {
Button(action: {
isPresented = false
}, label: {
Text("OK").frame(maxWidth: .infinity)
}).charcoalPrimaryButton(size: .medium)

return ZStack {
Button(action: {
isPresented = true
}, label: {
Text("Show")
.padding()
})
.charcoalModal(
title: "Title",
style: .center,
isPresented: $isPresented,
actions: {
Button(action: {
isPresented = false
}, label: {
Text("OK").frame(maxWidth: .infinity)
}).charcoalPrimaryButton(size: .medium)

Button(action: {
isPresented = false
}, label: {
Text("Dismiss").frame(maxWidth: .infinity)
}).charcoalDefaultButton(size: .medium)
}
) {
NavigationView {
VStack(spacing: 10) {
Text("Hello This is a center dialog from Charcoal")
.charcoalTypography16Regular()
.frame(maxWidth: .infinity)
Button(action: {
isPresented = false
}, label: {
Text("Dismiss").frame(maxWidth: .infinity)
}).charcoalDefaultButton(size: .medium)
}
) {
NavigationView {
VStack(spacing: 10) {
Text("Hello This is a center dialog from Charcoal")
.charcoalTypography16Regular()
.frame(maxWidth: .infinity)

TextField("Simple text field", text: $text1).charcoalTextField()
}.padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20))
.navigationTitle("SwiftUI")
.navigationBarTitleDisplayMode(.inline)
TextField("Simple text field", text: $text1).charcoalTextField()
}.padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20))
.navigationTitle("SwiftUI")
.navigationBarTitleDisplayMode(.inline)
}
}
}
}
}

@available(iOS 17, *)
#Preview {
CharcoalModalViewPreview()
}

0 comments on commit 7168c65

Please sign in to comment.