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
SwiftUIと比較してみた時のFlutter
Search
Tatsuya Tanaka
June 23, 2020
Programming
2.1k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SwiftUIと比較してみた時のFlutter
https://yj-meetup.connpass.com/event/178577/
#wwdctokyo
Tatsuya Tanaka
June 23, 2020
More Decks by Tatsuya Tanaka
See All by Tatsuya Tanaka
iPhoneのセンサー情報をmacOSアプリでリアルタイム活用するための技術
tattn
1
810
Better use of SwiftUI
tattn
0
520
Swift Concurrencyによる安全で快適な非同期処理
tattn
2
1.5k
iOSアプリの技術選択2022
tattn
7
4k
Widget Suggestions 対応と ヤフーの新OS対応
tattn
1
1.4k
WidgetKitで良い体験を作るには / Good experience with WidgetKit
tattn
2
2k
既存アプリにSwiftUIをどう組み込んでいくか
tattn
8
2.6k
iOS 14からのアプリ内課金
tattn
5
3.2k
iOS 14の位置情報系アップデート
tattn
0
23k
Other Decks in Programming
See All in Programming
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
360
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
460
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
380
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
Event is what happens
moro
1
190
SREの越境 / SRE Collaboration
y0hgi
2
300
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.7k
残高管理から台帳サービスへの進化
artoy
1
190
ChromeでローカルLLM
ryu1013
0
110
Simple Storage Service(S3) is not simple
iwatsukayura
0
270
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Transcript
SwiftUIͱൺֱͯ͠Έͨ࣌ͷFlutter ాதୡ (@tattn) #wwdctokyo
ాத ୡ / ͨͳͨͭ (@tattn) • Yahoo!ΧʔφϏ ←Yahoo!Ҋ • iOSΞϓϦΤϯδχΞ
• ৽ٕज़ͷݕূ @tattn @tanakasan2525 @tattn Copyright (C) 2020 Yahoo Japan Corporation. All Rights Reserved.
όʔνϟϧLODGEͲ͏Ͱ͠ΐ͏͔ʁ https://note.com/lodge/n/nfa4a40c057b1 3DϞσϥʔͱUnity͍͕͍Εҙ֎ͱ؆୯ʹ࡞Ε·͢ʂ
SwiftUIͬͯΈ·͔ͨ͠ʁ YES NO (clusterͷΤϞʔγϣϯ ͰԠ͍ͩ͘͞)
ࠓͷSwiftUI·ͩͭΒΈ͕ଟ͍ʂ
ݸਓతʹSwiftUIͰ࡞͍ͬͯͨΞϓϦΛ FlutterʹҠߦͨ͠Γɺ ۀͰFlutterΛݕূͨ͠Γ͍ͯ͠·͢
WWDC20લͱͷ͜ͱͰ Flutterͱൺֱͭͭ͠ SwiftUIͷਐԽʹظ͢ΔLTΛ͠·͢
Flutterͱ
Flutterͱ • GoogleʹΑͬͯ։ൃ͞ΕͨΦʔϓϯιʔεϞόΠϧΞϓϦSDK • ΫϩεϓϥοτϑΥʔϜ (iOS, Android, Web, macOS) •
DartͰهड़͢Δ • ίϯϙʔωϯτࢦɺϗοτϦϩʔυͳͲͷ ࠓͲ͖ͷઃܭػೳ
Flutterͷ͘͠Έ
Flutterͷ෦ https://flutter.dev/docs/resources/technical-overview ಠࣗͷϨϯμϦϯάΤϯδϯ(Skia) ͰUIViewʹඳը͠ɺUIΛදࣔ
ΈΜͳେ͖View Hierarchy FlutterViewControllerͷFlutterViewʹશͯඳը͞Ε͍ͯΔ (ScrollViewݟ͑ͳ͍ͱ͜Ζʹஔ) ͪͳΈʹ.xcworkspace࡞ΒΕΔͷͰ ωΠςΟϒͷσόοάXcodeͰͰ͖Δ
ίʔυ࣮ߦͷ͘͠Έ ϦϦʔεϏϧυ Dartίʔυ ػցޠ ίϯύΠϧ σόοάϏϧυ ػցޠ+Dart ࣮ߦதʹඞཁͳ෦͚ͩίϯύΠϧ͞ΕΔ (JIT) →ϗοτϦϩʔυ͕ޮ͘
࣮ߦલʹશͯίϯύΠϧ͞ΕΔ(AOT) →ಈ࡞͕͍
FlutterͰͷUIͷ࡞Γํ (ϘλϯΛԡͨ͠Β1૿͑ΔΞϓϦ)
ϘλϯΛԡ͢ͱ1૿͑Δը໘ (SwiftUI) struct ContentView: View { @State var count =
0 var body: some View { VStack { Text("Count: \(count)") .font(.largeTitle) Spacer() .frame(height: 20) Button(action: { self.count += 1 }, label: { Text("Increment") }) } } }
ϘλϯΛԡ͢ͱ1૿͑Δը໘ (Flutter) class CounterApp extends StatefulWidget { @override _CounterAppState createState()
=> _CounterAppState(); } class _CounterAppState extends State<CounterApp> { int _count = 0; @override Widget build(BuildContext context) { return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Text('Count: $_count', style: Theme.of(context).textTheme.headline5), SizedBox(height: 20), FlatButton( child: Text('Increment'), onPressed: () => setState(() => _count++), ) ], ), ); } } ͪΐͬͱίʔυྔଟ͘ݟ͑·͕͢ɺ εχϖοτͰࣗಈੜ͞ΕΔͷͰهड़ྔಉ͘͡Β͍
ϘλϯΛԡ͢ͱ1૿͑Δը໘ (Flutter) class _CounterAppState extends State<CounterApp> { int _count =
0; @override Widget build(BuildContext context) { return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Text('Count: $_count', style: Theme.of(context).textTheme.headline5), SizedBox(height: 20), FlatButton( child: Text('Increment'), onPressed: () => setState(() => _count++), ) ], ), ); } } ࣗಈੜ෦ΛΧοτͯ͠ຊ࣭ͷΈʹ͢Δͱ͜Μͳײ͡
ϘλϯΛԡ͢ͱ1૿͑Δը໘ (Flutter | SwiftUI) ࣅͨΑ͏ͳײ֮Ͱॻ͚·͢ class _CounterAppState extends State<CounterApp> {
int _count = 0; @override Widget build(BuildContext context) { return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Text('Count: $_count', ɹɹ style: Theme.of(context).textTheme.headline5), SizedBox(height: 20), FlatButton( child: Text('Increment'), onPressed: () => setState(() => _count++), ) ], ), ); } } struct ContentView: View { @State var count = 0 var body: some View { VStack { Text("Count: \(count)") .font(.largeTitle) Spacer() .frame(height: 20) Button(action: { self.count += 1 }, label: { Text("Increment") }) } } }
Flutterͷྑ͍ͱ͜Ζ (vs SwiftUI)
Hot Reload͕ "ͪΌΜͱ" ͑Δ • ⌘+SΛԡ͢ͱอଘ͞ΕࣗಈͰView͕ߋ৽͞ΕΔ • γϛϡϨʔλͰ࣮ػͰ͑Δ • ϓϩδΣΫτ͕େ͖ͯ͘ө·Ͱ1ඵ͘Β͍
• Ϧϩʔυલͷঢ়ଶ͕Δ
Hot Reload͕ "ͪΌΜͱ" ͑Δ • ⌘+SΛԡ͢ͱอଘ͞ΕࣗಈͰView͕ߋ৽͞ΕΔ • γϛϡϨʔλͰ࣮ػͰ͑Δ • ϓϩδΣΫτ͕େ͖ͯ͘ө·Ͱ1ඵ͘Β͍
• Ϧϩʔυલͷঢ়ଶ͕Δ SwiftUIͷϓϨϏϡʔίϯϙʔωϯτ୯Ґ͕جຊͰ͕͢ɺ FlutterσόοάϏϧυதͷΞϓϦΛಈతʹॻ͖͑Δײ֮
SwiftUIΑΓॊೈ • ϨΠΞτͰ࣮ݱͰ͖ͳ͍έʔε΄΅ͳͦ͞͏ • Γͳ͍ػೳΛิ͏খ͞ͳϥΠϒϥϦ͕ଟ͍ • ։ൃαΠΫϧ͕ૣ͘ɺ͙͢ʹΔ
SwiftUIΑΓॊೈ • ϨΠΞτͰ࣮ݱͰ͖ͳ͍έʔε΄΅ͳͦ͞͏ • Γͳ͍ػೳΛิ͏খ͞ͳϥΠϒϥϦ͕ଟ͍ • ։ൃαΠΫϧ͕ૣ͘ɺ͙͢ʹΔ • FlutterͷϑϨʔϜϫʔΫଆDart෦ ΞϓϦͷσόοά࣌ʹϒϨʔΫϙΠϯτΛஔ͍ͯ
σόοάͰ͖ΔʂͷͰमਖ਼ͷෑډ͕͍ (ͤΔਓ͕ଟ͍)
AndroidͰಈ͘ʂʂʂ
ωΠςΟϒͷػೳͲ͏͢Δͷʁ
ωΠςΟϒػೳͷݺͼग़͠ํ PlatformView PlatformChannel UIViewΛͬͯiOSͷΈͰUIΛಈ͔͠ɺ දࣔ݁ՌΛSkiaʹૹͬͯϨϯμϦϯά͢Δɻ →ωΠςΟϒͷViewΛFlutterͷWidgetʹΈࠐΊΔ ωΠςΟϒͰػೳΛ࣮͠ɺDart͔Βݺͼग़͢Έɻ ૬ޓʹσʔλͷΓऔΓ͕Ͱ͖Δ (σʔλܕͷ੍ݶ͋Δ) ͲͪΒSwift
/Kotlin Ͱॻ͚Δʂ
ωΠςΟϒΞϓϦʹFlutterΛຒΊࠐΉํ๏͋Δ Add to App ɾCocoaPodsͰFlutterΞϓϦΛऔΓࠐΉ ɾίϚϯυͰFrameworkԽͯ͠औΓࠐΉ ɾpodspecͰFrameworkԽΛCocoaPodsʹ·͔ͤͯऔΓࠐΉ IUUQTqVUUFSEFWEPDTEFWFMPQNFOUBEEUPBQQ ͳͲͷํ๏ͰطଘͷωΠςΟϒΞϓϦʹ FlutterΛ෦ಋೖ͢Δ͜ͱͰ͖·͢ɻ
(FlutterͷUI1ຕͷViewControllerͱͯ͠औΓѻ͑Δ)
SwiftUIͷํ͕ྑ͍෦
SwiftUIͷྑ͍ͱ͜Ζ ϝιουνΣʔϯ (modifier) ʹΑΔViewͷΧελϚΠζ ೖΕࢠΛݮΒͤͯಡΈ͍͢ɻ (ͨΓલͰ͕͢)ωΠςΟϒͷػೳΛ͔ΜͨΜʹσόοάͰ͖Δɻ Swiftຊʹྑ͍ݴޠɻ Text("WWDC") .padding() .border(Color.red,
width: 3) Container( decoration: BoxDecoration( border: Border.all(color: Colors.red, width: 3), ), padding: const EdgeInsets.all(8), child: Text("WWDC"), ) Container( decoration: BoxDecoration( border: Border.all(color: Colors.red, width: 3), ), child: Padding( padding: const EdgeInsets.all(8), child: Text("WWDC"), ), ), ωετΛݮΒͨ͢ΊʹpaddingΛ ҾͰࢦఆͰ͖ΔWidget͋Δ
͜Ε͔Β࢝·ΔWWDCʹ ظ͢Δ͜ͱ
Apple͞Μ͓ئ͍͠·͢ʂ ɾHot ReloadͷਐԽʹظʂ ɹɹɾσόοάϏϧυͰಈ͔ͯ͠ΔΞϓϦΛ ɹɹɹঢ়ଶΛͭͭ͠ॻ͖͍͑ͨ ɾViewͷΧελϚΠζੑΛߴͯ͘͠΄͍͠ʂ ɹɹɾཪʹ͍ΔUIKitAppKitͷViewʹ৮ΕΔΈͰྑ͍Ͱ͢ ɾWebͰಈ͘Α͏ʹͯ͠΄͍͠ʂ(ຊAndroidαϙʔτͯ͠΄͍͚͠Ͳ᩵ݴ͍·ͤΜ) ɹɹɾHTML /
CSS / JSΛexport͢Δػೳཉ͍͠ IUUQTqVUUFSEFWEPDTEFWFMPQNFOUUPPMTEFWUPPMTJOTQFDUPS
·ͱΊ
·ͱΊ • Flutter͔ͳΓΑ͘Ͱ͖͍ͯͯɺ࣮༻తɻ • ݱঢ়ͰSwiftUI/UIKitΑΓ"ѹత"ʹ շదʹॻ͚Δɻ • ͰSwiftࣗମSwiftUIͷઃܭັྗతʂ • ͜Ε͔Β࢝·ΔWWDCͰͷSwiftUIͷਐԽʹظ