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
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
260
AHC070解法紹介
eijirou
0
110
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
530
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
330
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
150
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
470
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
120
信頼性の目標を誰も求めてない
shubox
0
510
Intent as Code
shoppingjaws
6
970
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
290
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
108
250k
Designing Powerful Visuals for Engaging Learning
tmiket
1
540
Navigating Weather and Climate Data
rabernat
0
520
Code Review Best Practice
trishagee
74
20k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
700
Joys of Absence: A Defence of Solitary Play
codingconduct
1
510
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Rails Girls Zürich Keynote
gr2m
96
14k
Facilitating Awesome Meetings
lara
57
7.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Mind Mapping
helmedeiros
1
350
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でライブラリ管理、モジュール分割を段階的に行った。 今後はさらにマルチモジュール化を進めていく予定。