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
GANMA!にSwift PMを 導入した話
Search
masayuki sano
May 19, 2022
Programming
530
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GANMA!にSwift PMを 導入した話
iOS Snack bar #1 2022/05/13
masayuki sano
May 19, 2022
Other Decks in Programming
See All in Programming
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
610
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
350
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
180
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.4k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.4k
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2.2k
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
160
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
4k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
340
すこし踏み込む CancellationToken
htkym
2
1.6k
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
1.9k
Exploring anti-patterns in Rails
aemeredith
4
520
YesSQL, Process and Tooling at Scale
rocio
174
15k
Prompt Engineering for Job Search
mfonobong
0
480
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
300
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
350
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
450
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
520
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
How to train your dragon (web standard)
notwaldorf
96
6.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
460
Transcript
GANMA!にSwift PMを 導入した話 FLINTERS 佐野真之 iOS Snack bar #1 2022/5/13
自己紹介 FLINTERS / GANMA! iOSエンジニア 1600万ダウンロード突破! プレミアム会員(サブスク)、広告、GANMA!コイン、グッズ、書籍など
アジェンダ • GANMA!へのSwift Package Managerの段階的導入 ◦ ライブラリ管理 ◦ Embedded Framework
→ Swift Package ◦ Viewなどの移行 • その後の効果
Swift PM導入の背景 • xcodeprojファイルのコンフリクト • Embedded frameworkを気軽に作成しづらい • Swift PMでライブラリ管理
• Embedded frameworkをSwift Packageへ • マルチモジュール化 SwiftPMに対応したライブラリも増えてきたこともあり段階的に導入していく 課題感
Swift PM導入 app.xcworkspace/contents.xcworkspacedata Package.swift プロジェクトナビゲーター ワークスペースの編集、Package.swiftを追加 既存コードをAppに移動
<1st step> Cocoa Pods x Swift PMへ SwiftPMに対応 → Swift
PM バイナリ形式のxcframework → Swift PM それ以外の広告SDKなど → CocoaPods Carthage → 削除 モジュールへ依存追加 Package.resolved
Swift PMと CocoaPodsでのコンフリクト Swift PMでFirebase、CocoaPodsでAdMobをインストールした場合 GoogleAppMeasurementがどちらからもインストールされてしまう Podfile MyAdMob.podspec.json コンフリクトする依存を削除
Appでのライブラリ使用 App側でSwiftPMでインストールしたライブラリを使用したい場合は 必要なライブラリをModuleに含めてFrameworkをプロジェクトに依存を追加
<2nd step> Embedded Frameworkの移行 まずはEmbedded frameworkをSwift Packageに移行 そのあと第3ステップでViewやPresentationも移行 App ∟View
∟ ViewModel, Presenter ∟ Resources Embedded framework ∟DataLayer ∟ ModelLayer ∟ DomainLayer ∟ ApplicationLayer 以前のGANMA!のプロジェクト構成
Module、Frameworkの作成 Sources以下のディレクトリを .targetでModuleとして作成 .libraryで複数ModuleからFrameworkを作成 xcodeprojのようにコンフリクトしない!
Appへの取り込み FrameworkをAppのプロジェクトに追加していけばOK あとはモジュール単位でimport していくだけ App/File.swift imoprt ModelLayer ModelLayer.Model() ModelLayer =
Framework ModelLayer = Module
<3rd step> マルチモジュール化 xib, storyboardを使用する場合 App ∟View ∟ ViewModel, Presenter
∟ Resources 表示確認をしながら少しずつViewLayerに分離中 ViewのSwift Packageへの移動 コードからxibを使用する場合 Appに残っているコードをSwift Packageに移し モジュールを作成しやすいようにしていく
Assetモジュール作成 Appの画像や色のアセットを ViewLayerでも使用したい SwiftGenの自動生成コードを Assetモジュールとして分離 SwiftGenでの自動生成コード
@_exported import @_exported importにより同一モジュールでのimport Assetsを 書かなくても使用可能 @_exported import Assets //
import Assets がいらない File1.swit File2.swit Module A import ModuleA // Assets使用可能 File1.swit Module B
導入の効果 • マルチモジュール化しやすくなった。ミニアプリつくりやすい • アプリサイズが減った ◦ 23.5MB -> 20.6MB •
ライブラリバージョン変わってもコマンド叩かなくていい • ビルド時間短縮
まとめ Swift Package Managerでライブラリ管理、モジュール分割を段階的に行った。 今後はさらにマルチモジュール化を進めていく予定。