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
UIKitにSwiftUIを埋め込んだら 罠にハマった話
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hayate Kuronuma
May 12, 2026
Programming
19
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
UIKitにSwiftUIを埋め込んだら 罠にハマった話
Hayate Kuronuma
May 12, 2026
Transcript
19 slides
© 2026 Wantedly, Inc. UIKitにSwiftUIを埋め込んだら 罠にハマった話 #24 Mobile勉強会 ウォンテッドリー ×
チームラボ × Sansan Apr.21 2026 - Hayate Kuronuma
© 2026 Wantedly, Inc. 名前:黒沼 疾風 入社日:2025.09 ポジション:iOSエンジニア 性格診断:コントリビューター 自己紹介
hayate_k_eng
© 2026 Wantedly, Inc. 01 やったこと 02 起きた不具合 03 原因
04 修正と教訓 目次
© 2026 Wantedly, Inc. やったこと 01
© 2026 Wantedly, Inc. UIKitベースの応募モーダルに、 SwiftUIのチェックボタン群を 埋め込んだ • UIHostingController で
ラップ • 親子関係を定義: addChild → addSubview UIKitの画面にSwift UIを部分導入
© 2026 Wantedly, Inc. 同一モーダル内で複数 Sceneを切り替えて表示している UIKitの画面にSwift UIを部分導入 options loading
completed
© 2026 Wantedly, Inc. 1. モーダル内の Viewを全て非表示 2. 対象のSceneだけ表示 UIKitの画面にSwift
UIを部分導入 Control Logic isHidden = true / false で制御
© 2026 Wantedly, Inc. 起きた不具合 02
© 2026 Wantedly, Inc. プレミアムプランユーザーは応募後にメッセージ送信をすることができる 前提
© 2026 Wantedly, Inc. プレミアムユーザーが メッセージを入力出来なくなった! (キーボードの表示にとても時間がかかるようになった)
© 2026 Wantedly, Inc. 原因 03
© 2026 Wantedly, Inc. 起きていたこと CPU負荷:高 メッセージ入力画面において、 CPU負荷が 高まっている メソッドの呼び出し回数
viewDidLayoutSubviews() 約57,000回 の異常な呼び出しを検知
© 2026 Wantedly, Inc. 仮説:キーボード表示がトリガー? キーボードなし viewDidLayoutSubviews は1回だけになった キーボードあり 57,000回のレイアウトループが発生
結論:キーボード表示がトリガーだった
© 2026 Wantedly, Inc. レイアウトループの流れ 1. メッセージ入力モーダルでキーボード表示 2. キーボード表示時のレイアウト調整で layoutIfNeeded()を実行
3. Viewのレイアウト更新が走る 4. isHiddenで隠していたUIHostingViewがレイアウト更新対象になる 5. UIHostingViewがさらにレイアウト更新を要求しているよう(ブラックボックス)
© 2026 Wantedly, Inc. 修正と教訓 04
© 2026 Wantedly, Inc. HostingControllerをViewから完全に削除 レイアウトループの原因となっていた UIHostingControllerを整理し、Viewから完全に削除 表示された🙌
© 2026 Wantedly, Inc. 表示しないHostingViewは removeしよう 教訓・まとめ isHiddenで隠しても、View階層に残ったUIHostingControllerが レイアウトループの原因になりうるケースがある
© 2026 Wantedly, Inc.
© 2026 Wantedly, Inc. ご清聴ありがとうございました!
More Decks by Hayate Kuronuma
See All by Hayate Kuronuma
本番だけWebViewが500エラーになる
hayatekuronuma
0
60
ユーザー価値を届け続けるために、ウォンテッドリーが大切にしている文化
hayatekuronuma
0
12
Other Decks in Programming
See All in Programming
The Cost of the DOM
ypresto
9
4.8k
MCPの次は何? MCP AppsとWebMCPを体験する
okajun35
0
110
観測者から当事者へ、AI 時代にドメインへ深入りする知識と技術 / From Observer to Practitioner: Going Deep into Domains in the Age of AI
nrslib
5
2.3k
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
450
Getting Started with Vibe Coding
miccheng
0
260
Compiling Your Language to WasmGC & Friends
tanishiking
1
1.1k
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
450
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
260
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
3
280
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
高速開発を止めずに 性能を上げる Flyleのシステム刷新と改善の歴史
azihsoyn
0
130
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
480
Designing for Timeless Needs
cassininazir
1
570
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
KATA
mclloyd
PRO
35
16k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
340
Six Lessons from altMBA
skipperchong
29
4.6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
A Soul's Torment
seathinner
9
4k