mirror of
https://github.com/samsonjs/AccessibilityTalk.git
synced 2026-03-25 09:25:52 +00:00
Finish up current demos and account for VoiceOver
This commit is contained in:
parent
7d48a898e6
commit
f74b1c3362
16 changed files with 264 additions and 252 deletions
|
|
@ -14,14 +14,13 @@
|
|||
96088D722B797FBA00E062FB /* FlipLayoutAxisView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D712B797FBA00E062FB /* FlipLayoutAxisView.swift */; };
|
||||
96088D742B7980D700E062FB /* DynamicTypeAdaptiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D732B7980D700E062FB /* DynamicTypeAdaptiveView.swift */; };
|
||||
96088D762B7981DC00E062FB /* FlexibleSizingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D752B7981DC00E062FB /* FlexibleSizingView.swift */; };
|
||||
96088D782B7981EB00E062FB /* ExampleFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D772B7981EB00E062FB /* ExampleFormView.swift */; };
|
||||
96088D782B7981EB00E062FB /* ExampleFormGoodView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D772B7981EB00E062FB /* ExampleFormGoodView.swift */; };
|
||||
96088D7A2B79827D00E062FB /* ExampleFormBadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D792B79827D00E062FB /* ExampleFormBadView.swift */; };
|
||||
96088D7C2B79828900E062FB /* FlexibleSizingBadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D7B2B79828900E062FB /* FlexibleSizingBadView.swift */; };
|
||||
96088D7E2B79829000E062FB /* FlipLayoutAxisBadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D7D2B79829000E062FB /* FlipLayoutAxisBadView.swift */; };
|
||||
96088D802B798DBE00E062FB /* FlexibleSizingBadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D7F2B798DBE00E062FB /* FlexibleSizingBadViewController.swift */; };
|
||||
96088D822B79925200E062FB /* FlexibleSizingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D812B79925200E062FB /* FlexibleSizingViewController.swift */; };
|
||||
96088D842B799ABA00E062FB /* TextSizingBadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D832B799ABA00E062FB /* TextSizingBadView.swift */; };
|
||||
96088D802B798DBE00E062FB /* FlexibleSizingBadUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D7F2B798DBE00E062FB /* FlexibleSizingBadUIView.swift */; };
|
||||
96088D822B79925200E062FB /* FlexibleSizingGoodUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D812B79925200E062FB /* FlexibleSizingGoodUIView.swift */; };
|
||||
96088D862B799B1400E062FB /* TextSizingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D852B799B1400E062FB /* TextSizingView.swift */; };
|
||||
96088D882B7AFE7D00E062FB /* BadGoodView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D872B7AFE7D00E062FB /* BadGoodView.swift */; };
|
||||
96088D8A2B7B009400E062FB /* FlexibleSizingUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D892B7B009400E062FB /* FlexibleSizingUIView.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -33,14 +32,13 @@
|
|||
96088D712B797FBA00E062FB /* FlipLayoutAxisView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlipLayoutAxisView.swift; sourceTree = "<group>"; };
|
||||
96088D732B7980D700E062FB /* DynamicTypeAdaptiveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicTypeAdaptiveView.swift; sourceTree = "<group>"; };
|
||||
96088D752B7981DC00E062FB /* FlexibleSizingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingView.swift; sourceTree = "<group>"; };
|
||||
96088D772B7981EB00E062FB /* ExampleFormView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleFormView.swift; sourceTree = "<group>"; };
|
||||
96088D772B7981EB00E062FB /* ExampleFormGoodView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleFormGoodView.swift; sourceTree = "<group>"; };
|
||||
96088D792B79827D00E062FB /* ExampleFormBadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleFormBadView.swift; sourceTree = "<group>"; };
|
||||
96088D7B2B79828900E062FB /* FlexibleSizingBadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingBadView.swift; sourceTree = "<group>"; };
|
||||
96088D7D2B79829000E062FB /* FlipLayoutAxisBadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlipLayoutAxisBadView.swift; sourceTree = "<group>"; };
|
||||
96088D7F2B798DBE00E062FB /* FlexibleSizingBadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingBadViewController.swift; sourceTree = "<group>"; };
|
||||
96088D812B79925200E062FB /* FlexibleSizingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingViewController.swift; sourceTree = "<group>"; };
|
||||
96088D832B799ABA00E062FB /* TextSizingBadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextSizingBadView.swift; sourceTree = "<group>"; };
|
||||
96088D7F2B798DBE00E062FB /* FlexibleSizingBadUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingBadUIView.swift; sourceTree = "<group>"; };
|
||||
96088D812B79925200E062FB /* FlexibleSizingGoodUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingGoodUIView.swift; sourceTree = "<group>"; };
|
||||
96088D852B799B1400E062FB /* TextSizingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextSizingView.swift; sourceTree = "<group>"; };
|
||||
96088D872B7AFE7D00E062FB /* BadGoodView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadGoodView.swift; sourceTree = "<group>"; };
|
||||
96088D892B7B009400E062FB /* FlexibleSizingUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlexibleSizingUIView.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -75,18 +73,17 @@
|
|||
children = (
|
||||
96088D612B797B7700E062FB /* AccessibilityTalkApp.swift */,
|
||||
96088D652B797B7900E062FB /* Assets.xcassets */,
|
||||
96088D872B7AFE7D00E062FB /* BadGoodView.swift */,
|
||||
96088D632B797B7700E062FB /* ContentView.swift */,
|
||||
96088D732B7980D700E062FB /* DynamicTypeAdaptiveView.swift */,
|
||||
96088D792B79827D00E062FB /* ExampleFormBadView.swift */,
|
||||
96088D772B7981EB00E062FB /* ExampleFormView.swift */,
|
||||
96088D7B2B79828900E062FB /* FlexibleSizingBadView.swift */,
|
||||
96088D7F2B798DBE00E062FB /* FlexibleSizingBadViewController.swift */,
|
||||
96088D772B7981EB00E062FB /* ExampleFormGoodView.swift */,
|
||||
96088D7F2B798DBE00E062FB /* FlexibleSizingBadUIView.swift */,
|
||||
96088D812B79925200E062FB /* FlexibleSizingGoodUIView.swift */,
|
||||
96088D892B7B009400E062FB /* FlexibleSizingUIView.swift */,
|
||||
96088D752B7981DC00E062FB /* FlexibleSizingView.swift */,
|
||||
96088D812B79925200E062FB /* FlexibleSizingViewController.swift */,
|
||||
96088D7D2B79829000E062FB /* FlipLayoutAxisBadView.swift */,
|
||||
96088D712B797FBA00E062FB /* FlipLayoutAxisView.swift */,
|
||||
96088D672B797B7900E062FB /* Preview Content */,
|
||||
96088D832B799ABA00E062FB /* TextSizingBadView.swift */,
|
||||
96088D852B799B1400E062FB /* TextSizingView.swift */,
|
||||
);
|
||||
path = AccessibilityTalk;
|
||||
|
|
@ -175,13 +172,12 @@
|
|||
96088D642B797B7700E062FB /* ContentView.swift in Sources */,
|
||||
96088D622B797B7700E062FB /* AccessibilityTalkApp.swift in Sources */,
|
||||
96088D722B797FBA00E062FB /* FlipLayoutAxisView.swift in Sources */,
|
||||
96088D842B799ABA00E062FB /* TextSizingBadView.swift in Sources */,
|
||||
96088D822B79925200E062FB /* FlexibleSizingViewController.swift in Sources */,
|
||||
96088D822B79925200E062FB /* FlexibleSizingGoodUIView.swift in Sources */,
|
||||
96088D7A2B79827D00E062FB /* ExampleFormBadView.swift in Sources */,
|
||||
96088D782B7981EB00E062FB /* ExampleFormView.swift in Sources */,
|
||||
96088D7E2B79829000E062FB /* FlipLayoutAxisBadView.swift in Sources */,
|
||||
96088D7C2B79828900E062FB /* FlexibleSizingBadView.swift in Sources */,
|
||||
96088D802B798DBE00E062FB /* FlexibleSizingBadViewController.swift in Sources */,
|
||||
96088D782B7981EB00E062FB /* ExampleFormGoodView.swift in Sources */,
|
||||
96088D882B7AFE7D00E062FB /* BadGoodView.swift in Sources */,
|
||||
96088D8A2B7B009400E062FB /* FlexibleSizingUIView.swift in Sources */,
|
||||
96088D802B798DBE00E062FB /* FlexibleSizingBadUIView.swift in Sources */,
|
||||
96088D862B799B1400E062FB /* TextSizingView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -241,7 +237,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
|
|
@ -298,7 +294,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
|
|
|
|||
53
AccessibilityTalk/BadGoodView.swift
Normal file
53
AccessibilityTalk/BadGoodView.swift
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// BadGoodView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-12.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct BadGoodView<BadContent: View, GoodContent: View>: View {
|
||||
let title: String
|
||||
let bad: BadContent
|
||||
let good: GoodContent
|
||||
|
||||
init(
|
||||
_ title: String,
|
||||
@ViewBuilder bad: () -> BadContent,
|
||||
@ViewBuilder good: () -> GoodContent
|
||||
) {
|
||||
self.title = title
|
||||
self.bad = bad()
|
||||
self.good = good()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("❌ Bad")
|
||||
.font(.title)
|
||||
bad.frame(maxHeight: .infinity)
|
||||
|
||||
Divider()
|
||||
|
||||
Text("✅ Good")
|
||||
.font(.title)
|
||||
.accessibilityLabel("Good")
|
||||
good.frame(maxHeight: .infinity)
|
||||
}
|
||||
.navigationTitle(title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
BadGoodView("Text Sizing") {
|
||||
Text("No bueno")
|
||||
.font(.system(size: 16))
|
||||
} good: {
|
||||
Text("¡Mucho mejor!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,33 +11,28 @@ struct ContentView: View {
|
|||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section {
|
||||
NavigationLink("❌ Text Sizing") { TextSizingBadView() }
|
||||
NavigationLink("✅ Text Sizing") { TextSizingView() }
|
||||
Section("1. Text Sizing") {
|
||||
NavigationLink("SwiftUI") { TextSizingView() }
|
||||
}
|
||||
Section {
|
||||
NavigationLink("❌ Flexible Sizing (UIKit)") { FlexibleSizingBadUIView() }
|
||||
NavigationLink("✅ Flexible Sizing (UIKit)") { FlexibleSizingUIView() }
|
||||
Section("2. Flexible Sizing") {
|
||||
NavigationLink("SwiftUI") { FlexibleSizingView() }
|
||||
NavigationLink("UIKit") { FlexibleSizingUIView() }
|
||||
}
|
||||
Section {
|
||||
NavigationLink("❌ Flexible Sizing (SwiftUI)") { FlexibleSizingBadView() }
|
||||
NavigationLink("✅ Flexible Sizing (SwiftUI)") { FlexibleSizingView() }
|
||||
Section("3. Flip Layout Axis") {
|
||||
NavigationLink("SwiftUI") { FlipLayoutAxisView() }
|
||||
}
|
||||
Section {
|
||||
NavigationLink("❌ Flip Layout Axis") { FlipLayoutAxisBadView() }
|
||||
NavigationLink("✅ Flip Layout Axis") { FlipLayoutAxisView() }
|
||||
Section("4. Example Form") {
|
||||
NavigationLink("❌ Bad SwiftUI Form") { ExampleFormBadView() }
|
||||
NavigationLink(destination: ExampleFormGoodView()) {
|
||||
Text("✅ Good SwiftUI Form")
|
||||
.accessibilityLabel("Good SwiftUI Form")
|
||||
}
|
||||
Section {
|
||||
NavigationLink("❌ Example Form") { ExampleFormBadView() }
|
||||
NavigationLink("✅ Example Form") { ExampleFormView() }
|
||||
}
|
||||
}
|
||||
.navigationTitle("Accessibility Demo")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
var tktk: some View { Text("tktk") }
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct DynamicTypeAdaptiveStack<Content: View>: View {
|
|||
|
||||
init(
|
||||
verticalThreshold: DynamicTypeSize,
|
||||
spacing: Double = 16,
|
||||
spacing: Double = 8,
|
||||
@ViewBuilder content: () -> Content
|
||||
) {
|
||||
self.verticalThreshold = verticalThreshold
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct ExampleFormBadView: View {
|
|||
@State var passwordConfirmation = ""
|
||||
@State var wantsNewsletter = false
|
||||
|
||||
private let labelWidth: Double = 150
|
||||
private let labelWidth: Double = 100
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
|
|
@ -24,21 +24,21 @@ struct ExampleFormBadView: View {
|
|||
|
||||
HStack {
|
||||
label("Name")
|
||||
TextField("", text: $name, prompt: Text("Johnny Appleseed"))
|
||||
TextField(text: $name, prompt: Text("Johnny Appleseed")) { EmptyView() }
|
||||
.textContentType(.name)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
}
|
||||
|
||||
HStack {
|
||||
label("Email")
|
||||
TextField("", text: $email, prompt: Text("johnny@appleseed.net"))
|
||||
TextField(text: $email, prompt: Text("johnny@appleseed.net")) { EmptyView() }
|
||||
.textContentType(.emailAddress)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
}
|
||||
|
||||
HStack {
|
||||
label("Password")
|
||||
TextField("", text: $name, prompt: Text("super secret"))
|
||||
SecureField(text: $name, prompt: Text("super secret")) { EmptyView() }
|
||||
.textContentType(.newPassword)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ struct ExampleFormBadView: View {
|
|||
|
||||
private func label(_ title: String) -> some View {
|
||||
Text(title)
|
||||
.frame(minWidth: labelWidth, alignment: .trailing)
|
||||
.frame(width: labelWidth, alignment: .trailing) // minWidth is better, but not a lot
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
85
AccessibilityTalk/ExampleFormGoodView.swift
Normal file
85
AccessibilityTalk/ExampleFormGoodView.swift
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// ExampleFormView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExampleFormGoodView: View {
|
||||
@State var name = ""
|
||||
@State var email = ""
|
||||
@State var password = ""
|
||||
@State var wantsNewsletter = false
|
||||
|
||||
private let labelWidth: Double = 150
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ScrollView {
|
||||
VStack(spacing: 24) {
|
||||
Text("Sign Up")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
label("Name")
|
||||
TextField(text: $name) { EmptyView() }
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.textContentType(.name)
|
||||
.autocorrectionDisabled()
|
||||
.textInputAutocapitalization(.words)
|
||||
.accessibilityLabel("Name")
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
label("Email")
|
||||
TextField(text: $email) { EmptyView() }
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.textContentType(.emailAddress)
|
||||
.autocorrectionDisabled()
|
||||
.textInputAutocapitalization(.never)
|
||||
.accessibilityLabel("Email")
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
label("Password")
|
||||
SecureField(text: $password) { EmptyView() }
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.textContentType(.newPassword)
|
||||
.accessibilityLabel("Password")
|
||||
}
|
||||
|
||||
Toggle(isOn: $wantsNewsletter) {
|
||||
label("Sign up for\u{00a0}our newsletter")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button {} label: {
|
||||
Label("Create Account", systemImage: "arrow.right")
|
||||
.frame(minHeight: 44)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("✅ Example Form")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
private func label(_ title: String) -> some View {
|
||||
Text(title)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
ExampleFormGoodView()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
//
|
||||
// ExampleFormView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExampleFormView: View {
|
||||
@State var name = ""
|
||||
@State var email = ""
|
||||
@State var password = ""
|
||||
@State var wantsNewsletter = false
|
||||
|
||||
private let labelWidth: Double = 150
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("Sign Up")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
|
||||
TextField(text: $name) { Text("Name") }
|
||||
.textContentType(.name)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
|
||||
TextField(text: $email) { Text("Email") }
|
||||
.textContentType(.emailAddress)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
|
||||
SecureField(text: $password) { Text("Password") }
|
||||
.textContentType(.newPassword)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
|
||||
Toggle(isOn: $wantsNewsletter) {
|
||||
label("Sign up for our newsletter")
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button {} label: {
|
||||
Label("Create Account", systemImage: "arrow.right")
|
||||
.frame(width: 300, height: 44)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("✅ Example Form")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
private func label(_ title: String) -> some View {
|
||||
Text(title)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
ExampleFormView()
|
||||
}
|
||||
}
|
||||
|
|
@ -62,10 +62,10 @@ class FlexibleSizingBadViewController: UIViewController {
|
|||
}
|
||||
}
|
||||
|
||||
struct _FlexibleSizingBadUIView: UIViewControllerRepresentable {
|
||||
var title: String
|
||||
var width: CGFloat
|
||||
var height: CGFloat
|
||||
struct FlexibleSizingBadUIView: UIViewControllerRepresentable {
|
||||
var title: String = "Reticulate Splines"
|
||||
var width: CGFloat = 180
|
||||
var height: CGFloat = 44
|
||||
|
||||
func makeUIViewController(context: Context) -> FlexibleSizingBadViewController {
|
||||
FlexibleSizingBadViewController(title: title, width: width, height: height)
|
||||
|
|
@ -78,20 +78,10 @@ struct _FlexibleSizingBadUIView: UIViewControllerRepresentable {
|
|||
}
|
||||
}
|
||||
|
||||
struct FlexibleSizingBadUIView: View {
|
||||
var title: String = "Reticulate Splines"
|
||||
var width: CGFloat = 180
|
||||
var height: CGFloat = 44
|
||||
|
||||
var body: some View {
|
||||
_FlexibleSizingBadUIView(title: title, width: width, height: height)
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingBadUIView()
|
||||
.navigationTitle("❌ Flexible Sizing (UIKit)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingBadUIView()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// FlexibleSizingBadView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct FlexibleSizingBadView: View {
|
||||
var body: some View {
|
||||
Button {} label: {
|
||||
Text("Reticulate Splines")
|
||||
.frame(width: 180, height: 44)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.navigationTitle("❌ Flexible Sizing (SwiftUI)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingBadView()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// FlexibleSizingViewController.swift
|
||||
// FlexibleSizingGoodUIView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
class FlexibleSizingViewController: UIViewController {
|
||||
class FlexibleSizingGoodViewController: UIViewController {
|
||||
var buttonTitle: String {
|
||||
didSet {
|
||||
button.setTitle(buttonTitle, for: .normal)
|
||||
|
|
@ -57,36 +57,26 @@ class FlexibleSizingViewController: UIViewController {
|
|||
}
|
||||
}
|
||||
|
||||
struct _FlexibleSizingUIView: UIViewControllerRepresentable {
|
||||
var title: String
|
||||
var horizontalPadding: CGFloat
|
||||
var verticalPadding: CGFloat
|
||||
struct FlexibleSizingGoodUIView: UIViewControllerRepresentable {
|
||||
var title: String = "Reticulate Splines"
|
||||
var horizontalPadding: CGFloat = 24
|
||||
var verticalPadding: CGFloat = 12
|
||||
|
||||
func makeUIViewController(context: Context) -> FlexibleSizingViewController {
|
||||
FlexibleSizingViewController(title: title, horizontalPadding: horizontalPadding, verticalPadding: verticalPadding)
|
||||
func makeUIViewController(context: Context) -> FlexibleSizingGoodViewController {
|
||||
FlexibleSizingGoodViewController(title: title, horizontalPadding: horizontalPadding, verticalPadding: verticalPadding)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: FlexibleSizingViewController, context: Context) {
|
||||
func updateUIViewController(_ uiViewController: FlexibleSizingGoodViewController, context: Context) {
|
||||
uiViewController.buttonTitle = title
|
||||
uiViewController.horizontalPadding = horizontalPadding
|
||||
uiViewController.verticalPadding = verticalPadding
|
||||
}
|
||||
}
|
||||
|
||||
struct FlexibleSizingUIView: View {
|
||||
var title: String = "Reticulate Splines"
|
||||
var horizontalPadding: CGFloat = 24
|
||||
var verticalPadding: CGFloat = 12
|
||||
|
||||
var body: some View {
|
||||
_FlexibleSizingUIView(title: title, horizontalPadding: horizontalPadding, verticalPadding: verticalPadding)
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingUIView()
|
||||
.navigationTitle("✅ Flexible Sizing (UIKit)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingUIView()
|
||||
}
|
||||
}
|
||||
26
AccessibilityTalk/FlexibleSizingUIView.swift
Normal file
26
AccessibilityTalk/FlexibleSizingUIView.swift
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// FlexibleSizingUIView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-12.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct FlexibleSizingUIView: View {
|
||||
var body: some View {
|
||||
BadGoodView("Flexible Sizing (UIKit)") {
|
||||
FlexibleSizingBadUIView()
|
||||
} good: {
|
||||
FlexibleSizingGoodUIView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingUIView()
|
||||
.navigationTitle("Flexible Sizing (UIKit)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
|
@ -9,19 +9,27 @@ import SwiftUI
|
|||
|
||||
struct FlexibleSizingView: View {
|
||||
var body: some View {
|
||||
BadGoodView("Flexible Sizing (SwiftUI)") {
|
||||
Button {} label: {
|
||||
Text("Reticulate Splines")
|
||||
.frame(width: 180, height: 44)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
} good: {
|
||||
Button {} label: {
|
||||
Text("Reticulate Splines")
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.vertical, 12)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.navigationTitle("✅ Flexible Sizing (SwiftUI)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlexibleSizingView()
|
||||
.navigationTitle("Flexible Sizing (SwiftUI)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// FlipLayoutAxisBadView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct FlipLayoutAxisBadView: View {
|
||||
private let titles: [String] = ["Video", "Audio", "Info"]
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
ForEach(titles, id: \.self) { title in
|
||||
Button {} label: {
|
||||
Text(title)
|
||||
.frame(minWidth: 80)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
}
|
||||
.navigationTitle("❌ Flip Layout")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
FlipLayoutAxisBadView()
|
||||
}
|
||||
}
|
||||
|
|
@ -11,17 +11,28 @@ struct FlipLayoutAxisView: View {
|
|||
private let titles: [String] = ["Video", "Audio", "Info"]
|
||||
|
||||
var body: some View {
|
||||
DynamicTypeAdaptiveStack(verticalThreshold: .accessibility3) {
|
||||
BadGoodView("Flip Layout") {
|
||||
HStack {
|
||||
ForEach(titles, id: \.self) { title in
|
||||
Button {} label: {
|
||||
Text(title)
|
||||
.frame(minWidth: 80)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
}
|
||||
.navigationTitle("✅ Flip Layout")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} good: {
|
||||
DynamicTypeAdaptiveStack(verticalThreshold: .accessibility3) {
|
||||
ForEach(titles, id: \.self) { title in
|
||||
Button {} label: {
|
||||
Text(title)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// TextSizingBadView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TextSizingBadView: View {
|
||||
var body: some View {
|
||||
Text("No bueno")
|
||||
.font(.system(size: 16))
|
||||
.navigationTitle("❌ Text Sizing")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
TextSizingBadView()
|
||||
}
|
||||
}
|
||||
|
|
@ -9,9 +9,12 @@ import SwiftUI
|
|||
|
||||
struct TextSizingView: View {
|
||||
var body: some View {
|
||||
BadGoodView("Text Sizing") {
|
||||
Text("No bueno")
|
||||
.font(.system(size: 16))
|
||||
} good: {
|
||||
Text("¡Mucho mejor!")
|
||||
.navigationTitle("✅ Text Sizing")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue