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
Hierarchical Structure について / About Hierarchica...
Search
Jierong Li
July 29, 2021
Programming
1
500
Hierarchical Structure について / About Hierarchical Structure
Jierong Li
July 29, 2021
Tweet
Share
More Decks by Jierong Li
See All by Jierong Li
一般的な通信でも使える バックグラウンドURLSessionの活用方法 / How to use background URLSession for general network data transfer tasks.
myihsan
0
2.3k
Multi-Module 101
myihsan
0
340
What’s New in Accessibility WWDC21
myihsan
1
300
Property WrapperでDecodableのデフォルト値を設定 / Providing Default Value for Decodable Property by Property Wrapper
myihsan
1
290
モックフレームワーク比較 / Mocking Framework Comparison
myihsan
0
520
Other Decks in Programming
See All in Programming
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
500
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
3
5k
エンジニア向け採用ピッチ資料
inusan
0
180
5つのアンチパターンから学ぶLT設計
narihara
1
160
PipeCDのプラグイン化で目指すところ
warashi
1
260
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
3
740
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
50
32k
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
60
17k
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
620
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
130
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
620
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Automating Front-end Workflow
addyosmani
1370
200k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
The Invisible Side of Design
smashingmag
301
51k
Building Applications with DynamoDB
mza
95
6.5k
Code Reviewing Like a Champion
maltzj
524
40k
Facilitating Awesome Meetings
lara
54
6.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Transcript
HIERARCHICAL STRUCTURE について KOTLIN MULTIPLATFORM MOBILE勉強会 WANTEDLY × チームラボ #2
⾃⼰紹介 JIERONG LI (李) ▸ 株式会社ゆめみ ▸ iOSエンジニア ▸ KMMでAndroid開発キャッチアップ
▸ 永遠にリリースできず個⼈開発 ▸ https://jierong.dev
HIERARCHICAL STRUCTURE とは
HIERARCHICAL STRUCTURE とは コード共有の階層化 同じプラットフォームでアーキテクチャー複数
HIERARCHICAL STRUCTURE とは HIERARCHY STRUCTURE 有効にする gradle.propertiesに下記を追加するだけ kotlin.mpp.enableGranularSourceSetsMetadata=true
HIERARCHICAL STRUCTURE とは ⼿動で定義 kotlin { iosX64() iosArm64() sourceSets {
val commonMain by sourceSets.getting val iosX64Main by sourceSets.getting val iosArm64Main by sourceSets.getting val iosMain by sourceSets.creating { dependsOn(commonMain) iosX64Main.dependsOn(this) iosArm64Main.dependsOn(this) } } }
HIERARCHICAL STRUCTURE とは シートカット ▸ ios ▸ iosArm64、iosX64 ▸ watchOS
▸ watchosArm32、watchosArm64、watchosX64 ▸ tvOS ▸ tvosArm64、tvosX64
HIERARCHICAL STRUCTURE とは TARGET SHORTCUT kotlin { ios() }
既知の不具合
既知の不具合 コード補完とシンタックス ハイライトが機能しない ▸ 外部依存(公式情報) ▸ Hierarchical structureサポートしないmultiplatformライブラリー ▸ サードパーティ
ネーティブ ライブラリー ▸ マルチモジュール(DroidKaigi / conference-app-2021で発覚)
既知の不具合 外部依存による不具合のワークアラウンド kotlin { val iosTarget: (String, KotlinNativeTarget.() -> Unit)
-> KotlinNativeTarget = if (System.getenv("SDK_NAME") ? . startsWith("iphoneos") == true) :: iosArm64 else :: iosX64 iosTarget("ios") }
既知の不具合 外部依存による不具合のワークアラウンド ビルド対象アーキテクチャーのみターゲットを作り、ターゲット名をiosにする (iosMainがソースになる) ▸ アーキテクチャーひとつずつでビルドする場合が⼗分 ▸ XCFramework配布で両⽅のアーキテクチャーが必要な場合では不都合
既知の不具合 外部依存による不具合のワークアラウンド・改 kotlin { iosArm64() iosX64("ios") sourceSets { val iosMain
by getting val iosArm64Main by getting { dependsOn(iosMain) } } }
既知の不具合 外部依存による不具合のワークアラウンド・改 ビルド対象に関わらず⽚⽅のターゲット名をiosにし(iosMainがソースになる)、もう⽚⽅からiosMainを依存 ▸ 両⽅のアーキテクチャーのターゲットが存在 ▸ テストがある場合 ▸ IntelプロセッサのMacでしか実⾏できない ▸
iosArm64ターゲットではテストタスクがない ▸ Appleシリコン未対応のが原因かも ▸ iosX64のターゲット名をiosにする必要がある ▸ iosArm64にするとなぜかiosX64Testタスクが依存しているlinkDebugTestIosX64タスクが compileKotlinIos(実質comipleKotlinIosArm64)タスクを依存し、失敗になる
既知の不具合 マルチモジュールによる不具合のワークアラウンド BY WATANAVEX 依存関係の解決にバグがあるようで、明記的にコンパイルさせることで解決 tasks.getByName("preBuild").dependsOn(tasks.getByName("compileKotlinIos"))
HIERARCHICAL STRUCTURE について 参考資料 ▸ Share code on platforms ▸
Workaround to enable IDE support for the shared iOS source set ▸ ワークアラウンド by watanavex