Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Exit 8 for SwiftUI
Search
ojun
April 12, 2025
Programming
1
170
Exit 8 for SwiftUI
ojun
April 12, 2025
Tweet
Share
More Decks by ojun
See All by ojun
Swift Evolution かるた
ojun9
2
110
Xcode 16のPreviewModifierと@Previewableを活用した効率的なプレビュー方法の考察
ojun9
4
820
Catch Up with Swift 5.10
ojun9
2
810
Overview: Swift OpenAPI Generator
ojun9
3
2.2k
if 式と switch 式による SwiftUI のプレビューエラー対策
ojun9
1
1.8k
楽しい夏休み!String Catalogs で新しい発見
ojun9
0
2.2k
ユニットテストを学んだ次に知りたかったApple標準APIに対するテストのやり方
ojun9
1
430
ハッカソンにおけるiOSアプリ開発での学びと楽しさ
ojun9
1
340
Other Decks in Programming
See All in Programming
#QiitaBash TDDでAIに設計イメージを伝える
ryosukedtomita
2
1.4k
がんばりすぎないコーディングルール運用術
tsukakei
1
110
コードに語らせよう――自己ドキュメント化が内包する楽しさについて / Let the Code Speak
nrslib
5
660
SpringBootにおけるオブザーバビリティのなにか
irof
1
860
ruby.wasmとWebSocketで遊ぼう!
lnit
0
150
AI Coding Agent Enablement in TypeScript
yukukotani
15
6.2k
JVM の仕組みを理解して PHP で実装してみよう
m3m0r7
PRO
1
240
AIコーディングの本質は“コード“ではなく“構造“だった / The essence of AI coding is not “code” but "structure
seike460
PRO
2
700
インターフェース設計のコツとツボ
togishima
2
370
私のRubyKaigi 2025 Kaigi Effect / My RubyKaigi 2025 Kaigi Effect
chobishiba
1
200
CRUD から CQRS へ ~ 分離が可能にする柔軟性
tkawae
0
210
MLOps Japan 勉強会 #52 - 特徴量を言語を越えて一貫して管理する, 『特徴量ドリブン』な MLOps の実現への試み
taniiicom
2
350
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Producing Creativity
orderedlist
PRO
345
40k
Scaling GitHub
holman
459
140k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
650
What's in a price? How to price your products and services
michaelherold
245
12k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
Automating Front-end Workflow
addyosmani
1370
200k
Building an army of robots
kneath
306
45k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Six Lessons from altMBA
skipperchong
28
3.8k
Practical Orchestrator
shlominoach
187
11k
Transcript
Exit 8 for SwiftUI ojun - DeNA co., Ltd. try!
Swift Tokyo 2025 LT 2025 / 04 / 11
None
Exit 1 Prevent double taps or simultaneous taps
Exit 1 Prevent double taps or simultaneous taps Two buttons
inside a VStack
Exit 1 Prevent double taps or simultaneous taps In this
case, we need to prevent multiple buttons from being tapped simultaneously. However, SwiftUI doesn’t provide a direct API to handle mutual exclusion between buttons.
Exit 1 Prevent double taps or simultaneous taps Set isExclusiveTouch
to false on the wrapped UIView and all of its child views. If needed, implement a custom gesture recognizer to handle touch exclusivity.
None
Exit 2 Match the line height to the Text
Exit 2 Match the line height to the Text Inside
the ZStack, there's a Color and an HStack. The HStack contains a Rectangle and a titleView.
Exit 2 Match the line height to the Text This
UI is similar to what you might see in a train schedule display.
Exit 2 Match the line height to the Text This
UI is similar to what you might see in a train schedule display. However, you can see that the orange line doesn't match the height of the Text.
Exit 2 Match the line height to the Text By
creating a structure that conforms to the Layout protocol, you can align their heights.
Exit 2 Match the line height to the Text Applying
this layout to the original code allows the orange line to match the height of the Text.
None
Exit 3 Customize the loading indicator
Exit 3 Customize the loading indicator
Exit 3 Customize the loading indicator Since customization isn't possible
in SwiftUI, we need to implement it using UIKit.
None
Exit 4 Dismiss the keyboard on scroll
Exit 4 Dismiss the keyboard on scroll This behavior is
supported on iOS 16 and later. The keyboard automatically hides when the user scrolls, which simpli fi es the design.
Exit 4 Dismiss the keyboard on scroll By using scrollDismissesKeyboard,
we can implement this in a much simpler way.
Exit 5 Presenting a share sheet
Exit 5 Presenting a share sheet This code works on
iOS 16 and later. We're currently using UIActivityViewController to show the Share Sheet.
Exit 5 Presenting a share sheet By switching to ShareLink,
we can eliminate the dependency on UIKit.
Exit 6 Empty data state
Exit 6 Empty data state
Exit 6 Empty data state
Exit 7 Mesh gradient expression
Exit 7 Mesh gradient expression
Exit 7 Mesh gradient expression Starting from iOS 18, MeshGradient
makes it easy to implement mesh gradients.
None
Exit 8 Square Without GeometryReader
Exit 8 Square Without GeometryReader
Exit 8 Square Without GeometryReader It's possible to create a
square without using GeometryReader by leveraging scaledToFit.
None
None