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
510
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.8k
Multi-Module 101
myihsan
0
350
What’s New in Accessibility WWDC21
myihsan
1
330
Property WrapperでDecodableのデフォルト値を設定 / Providing Default Value for Decodable Property by Property Wrapper
myihsan
1
320
モックフレームワーク比較 / Mocking Framework Comparison
myihsan
0
540
Other Decks in Programming
See All in Programming
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
140
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
270
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
AI Assistants for YourAngular Solutions @Angular Graz, March 2026
manfredsteyer
PRO
0
110
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
250
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
240
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
510
安いハードウェアでVulkan
fadis
1
810
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
250
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
130
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
320
Discover your Explorer Soul
emna__ayadi
2
1.1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Paper Plane
katiecoart
PRO
0
48k
Typedesign – Prime Four
hannesfritz
42
3k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
160
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