Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
徐々に増えているSwiftUI Anchor関連API
Search
tokizo
October 13, 2025
1.2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
徐々に増えているSwiftUI Anchor関連API
tokizo
October 13, 2025
More Decks by tokizo
See All by tokizo
iOS 曜日ランキングが出来上がるまで
tokizuoh
0
2.8k
メインスレッドをブロックさせないためのSwift Concurrencyクイズ
tokizuoh
1
6k
運動モチベーション継続のためのiOSアプリ開発
tokizuoh
0
1.1k
Xcode 15 で swift run が遅い
tokizuoh
0
3.9k
モノレポにおける path-filtering利用時でも GitHub ステータスのRequiredを 機能させたい!
tokizuoh
1
1.6k
累積和で配列の処理効率を改善しよう
tokizuoh
0
770
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
HDC tutorial
michielstock
2
970
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
It's Worth the Effort
3n
188
29k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
Marketing to machines
jonoalderson
1
5.9k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Making Projects Easy
brettharned
120
6.8k
Transcript
徐々に増えている SwiftUI Anchor 関連API tokizo / @tokizuoh 2025/10/10 DroidKaigi &
iOSDC After Talks Night 1
2 SwiftUI Anchor 使っていますか?
3 SwiftUI Anchorを 使えたり、受け取るAPIは 年々増えている
4 今日はいくつか 関連APIを紹介
rotation3DEffect (_:axis:anchor:anchorZ:perspective:) • iOS 13.0+ • Viewを指定した軸を中心に3次元で回転 • 回転の中心をAnchorで指定 5
https://developer.apple.com/documentation/SwiftUI/Vie w/rotation3DEffect(_:axis:anchor:anchorZ:perspective:)
6 rotation3DEffect (_:axis:anchor:anchorZ:perspective:)
gridCellAnchor(_:) • iOS 16.0+ • Gridのセル内での配置をAnchorで指定 7 https://developer.apple.com/documentation/swiftui/view /gridcellanchor(_:)
• 左: 与えられた領域の中央寄せ • 右: gridCellAnchor を使って 全体の中央寄せ ◦ 🟥
.gridCellAnchor(.bottomLeading) ◦ 本API登場前は数ステップ必要だった i. セル内の要素のサイズ取得 ii. セルのサイズ取得 iii. セルの内側の端まで要素をoffset移動 gridCellAnchor(_:) 8
ViewAlignedScrollTargetBehavior (limitBehavior:anchor:) • iOS 26.0+ ◦ Anchorなし版はiOS 17.0+ • スクロール要素の端を所定の位置で停止できる
◦ scrollTargetBehavior(_:) に渡して使用 • スクロールする要素の止まる位置をAnchorで指定 9 https://developer.apple.com/documentation/swiftui/view alignedscrolltargetbehavior/init(limitbehavior:anchor:)
• スクロール後は一番近い要素の左端で 止まる ◦ anchor: .leading を指定 10 ViewAlignedScrollTargetBehavior (limitBehavior:anchor:)
11 Anchor文脈の .leading などは何者なのか
12 定義を見てみる
Anchorで指定できる型はUnitPoint 13
相対的な値で表現されている 14
15 カスタムなUnitPointを渡せば 表現の幅が広がりそう
16 試しに、子要素の幅 ⅔ で スクロールを止めてみる
17 子要素の幅 ⅔ でスクロールを止める
18 子要素の幅 ⅔ でスクロールを止める
まとめ • 3つのAnchor関連のAPIを紹介した ◦ rotation3DEffect ◦ gridCellAnchor ◦ ViewAlignedScrollTargetBehavior •
Anchorを受け取るAPIが増えている • AnchorはUnitPointで値を指定することで より細やかに位置関係を定義できる 19
20 おわり