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
UIKitのMapKitを SwiftUIに移行できるのか
Search
kazumalab
January 21, 2025
Technology
1
61
UIKitのMapKitを SwiftUIに移行できるのか
「集まれSwift好き!Swift愛好会Vol.91 @dely」での発表資料です
kazumalab
January 21, 2025
Tweet
Share
More Decks by kazumalab
See All by kazumalab
今、CTOに求められるものとは?
kazumalab
0
350
Wedding × VRについて
kazumalab
0
100
Other Decks in Technology
See All in Technology
技術選定、下から見るか?横から見るか?
masakiokuda
0
190
純粋なイミュータブルモデルを設計してからイベントソーシングと組み合わせるDeciderの実践方法の紹介 /Introducing Decider Pattern with Event Sourcing
tomohisa
1
830
SES向け、生成AI時代におけるエンジニアリングとセキュリティ
longbowxxx
0
310
kintone開発のプラットフォームエンジニアの紹介
cybozuinsideout
PRO
0
470
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.2k
AIと融ける人間の冒険
pujisi
0
110
Claude Codeを使った情報整理術
knishioka
20
12k
小さく、早く、可能性を多産する。生成AIプロジェクト / prAIrie-dog
visional_engineering_and_design
0
380
Java 25に至る道
skrb
3
190
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
あの夜、私たちは「人間」に戻った。 ── 災害ユートピア、贈与、そしてアジャイルの再構築 / 20260108 Hiromitsu Akiba
shift_evolve
PRO
0
510
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
0
39
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
280
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
100
The Language of Interfaces
destraynor
162
26k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
38
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
410
Faster Mobile Websites
deanohume
310
31k
It's Worth the Effort
3n
187
29k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
54
49k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
540
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Transcript
UIKitのMapKitを SwiftUIに移行できるのか
自己紹介 武田 和馬(kazumalab) 株式会社LinQというスタートアップの会 社にいます SwiftとRubyを書きます 位置情報共有 (whoo)とかショートドラマ (DramaTik)のアプリとか作ってます FRUITSZIPPERオタクです
今回のテーマ ”そろそろMapKitをSwiftUI化 できないか? ”
□MKAnnotationViewを継承した AnnotationViewを作って... □MapViewにregisterして... □MKMapViewDelegateのviewForでAnnotationViewを返し て... UIKit x MapKitだと
UIKitのAnnotation
SwiftUIのMapViewとAnnotation
実際に表示
パフォーマンスはどうなのか? 1万のAnnotationを表示するの をUIKitとSwiftUIで比較 関東周りにAnnotationを敷き詰めるとこういう感じになる
UIKit iPhone16 Pro Max(iOS18.2)で動作
SwiftUI 明らかに SwiftUIのほうが起動時の時間が遅い。 60秒ぐらいかかっている。 (色々試して見たけどやっぱり遅い ) iPhone16 Pro Max(iOS18.2)で動作
SwiftUIで個数を減らす 個数 かかった時間 10,000 60s 5,000 13.91s 2,000 2.66s 1,000
1.2s 軽量のアプリケーションなら問題ないが、いろんなデータを Mapに表示したい場合は工夫が必要そう。
whooで大事なこと リアルタイムに Annotationを 動かす必要があります
Annotationを動かす(UIKit)
UIKitで1万個動かす このコードを `Timer.scheduledTimer` で1秒ごとに動かす
パフォーマンス 1万個を同時に動かす割にCPUが10%ぐらいの負荷。思ったより軽いかも ...?
SwiftUIでもやろうとした ピクリとも動かない。
そもそも AnnotationのcoordinateはBindingではないから更新されても動かない UIViewRepresentableを使ってMapKitからUIKitじゃないとだめっぽい
結論 結果的にSwiftUIの機能だけを使って開発するのは厳しそう whooは数が表示するアノテーションの数も多いので SwiftUIだとパフォーマン ス影響が出そう まだ、UIKitでいいよね
少し告知させてください