mirror of
https://github.com/samsonjs/AccessibilityTalk.git
synced 2026-03-25 09:25:52 +00:00
Add examples of a custom font and text in image
This commit is contained in:
parent
3d6b05f0e1
commit
d632512018
11 changed files with 99 additions and 8 deletions
|
|
@ -29,6 +29,8 @@
|
|||
96088D982B7B37B400E062FB /* BadSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D972B7B37B400E062FB /* BadSlider.swift */; };
|
||||
96088D9A2B7B39C300E062FB /* ExampleSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D992B7B39C300E062FB /* ExampleSliderView.swift */; };
|
||||
96088D9C2B7B3D6800E062FB /* GoodSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088D9B2B7B3D6800E062FB /* GoodSlider.swift */; };
|
||||
96088D9E2B7BB6E400E062FB /* Montserrat-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 96088D9D2B7BB6E400E062FB /* Montserrat-Medium.ttf */; };
|
||||
96088DA12B7BB99000E062FB /* TextImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96088DA02B7BB99000E062FB /* TextImageView.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -55,6 +57,9 @@
|
|||
96088D972B7B37B400E062FB /* BadSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadSlider.swift; sourceTree = "<group>"; };
|
||||
96088D992B7B39C300E062FB /* ExampleSliderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleSliderView.swift; sourceTree = "<group>"; };
|
||||
96088D9B2B7B3D6800E062FB /* GoodSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodSlider.swift; sourceTree = "<group>"; };
|
||||
96088D9D2B7BB6E400E062FB /* Montserrat-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Montserrat-Medium.ttf"; sourceTree = "<group>"; };
|
||||
96088D9F2B7BB71600E062FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
96088DA02B7BB99000E062FB /* TextImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextImageView.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -107,7 +112,10 @@
|
|||
96088D712B797FBA00E062FB /* FlipLayoutAxisView.swift */,
|
||||
96088D912B7B220200E062FB /* GoodDayView.swift */,
|
||||
96088D9B2B7B3D6800E062FB /* GoodSlider.swift */,
|
||||
96088D9F2B7BB71600E062FB /* Info.plist */,
|
||||
96088D9D2B7BB6E400E062FB /* Montserrat-Medium.ttf */,
|
||||
96088D672B797B7900E062FB /* Preview Content */,
|
||||
96088DA02B7BB99000E062FB /* TextImageView.swift */,
|
||||
96088D852B799B1400E062FB /* TextSizingView.swift */,
|
||||
);
|
||||
path = AccessibilityTalk;
|
||||
|
|
@ -180,6 +188,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
96088D692B797B7900E062FB /* Preview Assets.xcassets in Resources */,
|
||||
96088D9E2B7BB6E400E062FB /* Montserrat-Medium.ttf in Resources */,
|
||||
96088D662B797B7900E062FB /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -198,6 +207,7 @@
|
|||
96088D742B7980D700E062FB /* DynamicTypeAdaptiveView.swift in Sources */,
|
||||
96088D642B797B7700E062FB /* ContentView.swift in Sources */,
|
||||
96088D622B797B7700E062FB /* AccessibilityTalkApp.swift in Sources */,
|
||||
96088DA12B7BB99000E062FB /* TextImageView.swift in Sources */,
|
||||
96088D9C2B7B3D6800E062FB /* GoodSlider.swift in Sources */,
|
||||
96088D722B797FBA00E062FB /* FlipLayoutAxisView.swift in Sources */,
|
||||
96088D822B79925200E062FB /* FlexibleSizingGoodUIView.swift in Sources */,
|
||||
|
|
@ -347,6 +357,7 @@
|
|||
DEVELOPMENT_TEAM = QE4PFXDL4H;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = AccessibilityTalk/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
|
|
@ -376,6 +387,7 @@
|
|||
DEVELOPMENT_TEAM = QE4PFXDL4H;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = AccessibilityTalk/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
|
|
|
|||
23
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/Contents.json
vendored
Normal file
23
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "arm_sign.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "arm_sign@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "arm_sign@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign.png
vendored
Normal file
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign@2x.png
vendored
Normal file
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign@3x.png
vendored
Normal file
BIN
AccessibilityTalk/Assets.xcassets/AddSnippetSign.imageset/arm_sign@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
|
|
@ -14,28 +14,31 @@ struct ContentView: View {
|
|||
Section("1. Text Sizing") {
|
||||
NavigationLink("SwiftUI") { TextSizingView() }
|
||||
}
|
||||
Section("2. Flexible Sizing") {
|
||||
Section("2. Text in Images") {
|
||||
NavigationLink("SwiftUI") { TextImageView() }
|
||||
}
|
||||
Section("3. Flexible Sizing") {
|
||||
NavigationLink("SwiftUI") { FlexibleSizingView() }
|
||||
NavigationLink("UIKit") { FlexibleSizingUIView() }
|
||||
}
|
||||
Section("3. Flip Layout Axis") {
|
||||
Section("4. Flip Layout Axis") {
|
||||
NavigationLink("SwiftUI") { FlipLayoutAxisView() }
|
||||
}
|
||||
Section("4. Example Form") {
|
||||
Section("5. Example Form") {
|
||||
NavigationLink("❌ Bad SwiftUI Form") { ExampleFormBadView() }
|
||||
NavigationLink(destination: ExampleFormGoodView()) {
|
||||
Text("✅ Good SwiftUI Form")
|
||||
.accessibilityLabel("Good SwiftUI Form")
|
||||
}
|
||||
}
|
||||
Section("5. Calendar Grid") {
|
||||
Section("6. Calendar Grid") {
|
||||
NavigationLink("❌ Bad SwiftUI Grid") { CalendarBadView() }
|
||||
NavigationLink(destination: CalendarGoodView()) {
|
||||
Text("✅ Good SwiftUI Grid")
|
||||
.accessibilityLabel("Good SwiftUI Grid")
|
||||
}
|
||||
}
|
||||
Section("6. Custom Controls") {
|
||||
Section("7. Custom Controls") {
|
||||
NavigationLink("Example SwiftUI Slider") { ExampleSliderView() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct GoodDayView: View {
|
|||
.resizable()
|
||||
.scaledToFit()
|
||||
.clipped()
|
||||
.accessibilityIgnoresInvertColors()
|
||||
}
|
||||
|
||||
if !typeSize.isAccessibilitySize {
|
||||
|
|
|
|||
10
AccessibilityTalk/Info.plist
Normal file
10
AccessibilityTalk/Info.plist
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
<string>Montserrat-Medium.ttf</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
AccessibilityTalk/Montserrat-Medium.ttf
Normal file
BIN
AccessibilityTalk/Montserrat-Medium.ttf
Normal file
Binary file not shown.
31
AccessibilityTalk/TextImageView.swift
Normal file
31
AccessibilityTalk/TextImageView.swift
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// TextImageView.swift
|
||||
// AccessibilityTalk
|
||||
//
|
||||
// Created by Work on 2024-02-13.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TextImageView: View {
|
||||
var body: some View {
|
||||
BadGoodView("Text in Image") {
|
||||
Image("AddSnippetSign")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
} good: {
|
||||
Image("AddSnippetSign")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.accessibilityLabel("Add your daily snippet!")
|
||||
.accessibilityRemoveTraits(.isImage) // Suppress crappy ML interpretation of text
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
TextImageView()
|
||||
}
|
||||
}
|
||||
|
|
@ -10,10 +10,21 @@ import SwiftUI
|
|||
struct TextSizingView: View {
|
||||
var body: some View {
|
||||
BadGoodView("Text Sizing") {
|
||||
VStack {
|
||||
Text("No bueno")
|
||||
.font(.system(size: 16))
|
||||
|
||||
Text("Nicht gut")
|
||||
.font(Font.custom("Montserrat-Medium", fixedSize: 16))
|
||||
}
|
||||
} good: {
|
||||
VStack {
|
||||
Text("¡Mucho mejor!")
|
||||
|
||||
// Defaults to relativeTo: .body, just for illustration
|
||||
Text("Viel besser!")
|
||||
.font(Font.custom("Montserrat-Medium", size: 16, relativeTo: .body))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue