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
Swift5.1 SwiftUI
Search
ry-itto
July 13, 2019
Technology
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift5.1 SwiftUI
会津大学 x 日大 LTでの登壇資料です。
ry-itto
July 13, 2019
More Decks by ry-itto
See All by ry-itto
決定版!?OSSアプリプロジェクトでのBeta版アプリ配布の方法「Xcode Cloud + TestFlight」
ryitto
0
400
CA.swift#14
ryitto
3
5.9k
swift-argument-parserで 簡単 CLI ツール作り
ryitto
1
170
Data Essentials in SwiftUI
ryitto
1
540
Composable Architecture
ryitto
0
810
CollectionViewの 新しいレイアウトの作り方
ryitto
0
79
Other Decks in Technology
See All in Technology
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
120
From Prompt Engineering to Loop Engineering
shibuiwilliam
1
310
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
260
打造你的 AI 工作流:Agent Skill + MCP 實戰工作坊
appleboy
0
270
AI・ロボティクスと自動化社会 / AI, Robotics, and the Automated Society
ks91
PRO
0
120
攻撃者がいなくてもAIエージェントはインシデントを起こす
nomizone
0
170
スタートアップにAmazon EKSは早すぎる? マルチプロダクト戦略を加速する Platform Engineeringの実践 / Is Amazon EKS Too Soon for Startups? Practical Platform Engineering to Accelerate a Multi-Product Strategy
elmodev09
1
2k
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.3k
水を運ぶ人としてのリーダーシップ
izumii19
4
1.1k
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
0
310
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
1
940
プライバシー保護の理論と実践
lycorptech_jp
PRO
1
170
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
210
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
Documentation Writing (for coders)
carmenintech
77
5.4k
エンジニアに許された特別な時間の終わり
watany
107
250k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
350
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
320
Code Review Best Practice
trishagee
74
20k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Rails Girls Zürich Keynote
gr2m
96
14k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Transcript
4XJGUͷ৽ػೳͱ 4XJGU6* ձେֶίϯϐϡʔλཧֶ෦ ҏ౻྇
ࣗݾհ ҏ౻྇ ձେֶ J04 Χϐόϥ
ͦͦͳͥ4XJGU w ϝδϟʔόʔδϣϯ͡Όͳ͍͡ΌΜɻ w ͦΕΑΓ4XJGU6*Αɻ w 4XJGUͱ͔ڵຯͳ͍Θɻ
ճ w 4XJGUΛ͔͚Δਓ͕νϥοͱݟͯʮ͑ʁʯͬͯͳΔΑ͏ ͳจ๏͕૿͑ͨ w 4XJGU6*ʹେ͖͘औΓࠐ·Εɺ෦Ͱͨ͘͞Μ৽จ๏͕ ༻͞Ε͍ͯΔ w ॳݟͰਖ਼Θ͚Θ͔ΒΜɻ
4XJGUͷ৽ػೳ
Կݸ͔ฒͯΈͨ struct SwiftUIView : View { var body: some View
{ Text("Hello World!”) Text("Hello World!") } } @ObjectBinding var viewModel: HogeViewModel func add(x: Int, y: Int) -> Int { x + y }
͑ʁී௨͡ΌͶʁ
͖ͬ͞ͷίʔυͷதͷ৽ػೳ w !1SPQFSUZ%FMFHBUF w !@GVODUJPO#VJMEFS w 0QBRVF3FTVMU5ZQF w ؔͷฦΓͰҰߦͰࡁΉ߹ʹASFUVSOAΛॻ͔ͳͯ͘ Α͘ͳͬͨ
!1SPQFSUZ%FMFHBUF @ObjectBinding ← ͜Εͱ͔ @State ← ͜Ε KotlinͷҠৡϓϩύςΟʁΛݩʹͯ͠ΔͱͷهࣄΛͪΒͬͱΈͨΓ
!1SPQFSUZ%FMFHBUF ͍ํɿ @State var profile = Profile.default Ͳ͏ͳͬͯΔͷ͔ɿ @Stateͷ߹ɺprofileʹೖͬͨΛBinding<Profile>ͱ͍ͬͨ෩ʹϥο ϓ͢Δɻ
औΓग़͢ࡍʹ `profile`ͰΞΫηε͢ΔͱೖΕͨ, `$profile`ͱΞΫηε͢Δͱϥοϓͨ͠Λར༻Ͱ͖Δ
!@GVODUJPO#VJMEFS var body: some View { Text("Hello World!”) // ͜͜
Text("Hello World!”) // ͜͜ } 1SPQPTBM https://github.com/apple/swift-evolution/blob/ 9992cf3c11c2d5e0ea20bee98657d93902d5b174/proposals/XXXX- function-builders.md
!@GVODUJPO#VJMEFS ಠࣗͷ֦ு࡞ΕΔ(ྫɿ୯ޠΛݸผʹͯ͠ӳจ࡞) @_functionBuilder struct SentenceBuilder { static func buildBlock(_ strs:
String...) -> String { return strs.reduce(“”) { (res, str) -> String in return res + " " + str } } } func build(@SentenceBuilder block: () -> String) -> String { block() } print(build { "I";"am";"Ryoya Ito";"Nice";"to";"meet";"you!!" }) => I am Ryoya Ito Nice to meet you!!
!@GVODUJPO#VJMEFS w print(build { let name = "Ryoya Ito"
"I" “am" name "Nice" "to" "meet" "you!!" }) ɾΫϩʔδϟͰมఆ͕ٛͰ͖ͳ͍ ɾΫϩʔδϟͰifจͳͲ͕ॻ͚ͳ͍
0QBRVF3FTVMU5ZQF ͜ͷίʔυதͷ`some` var body: some View { Text("Hello World!") }
؆୯ʹදݱ͢ΔͱɺฦΓͰ૯শܕΛ͍͍ͨ࣌͏ͷɻ શͯ͜ͷهࣄʹ͋Δɾɾɾ Swift 5.1 ʹಋೖ͞ΕΔ Opaque Result Type ͱԿ͔
0QBRVF3FTVMU5ZQF ຊདྷͰ͋Ε func hoge() -> <H:AnyObject> H { } ͜͏ॻ͘ඞཁ͕͋ΔͷΛ
func hoge() -> some AnyObject { } ͱॻ͚ΔΑ͏ʹͨ͠ͷɻ γϯλοΫεγϡΨʔͰ͢ɻ
0QBRVF3FTVMU5ZQF func hoge() -> AnyObject { } ↑͜ΕͰΑ͘Ͷʁ ͍͍͑ɻ func
hoge() -> some AnyObject { } ͬͪ͜Ͱ͢ɻ
0QBRVF3FTVMU5ZQF ͳͥμϝͳͷ͔ʁ ઌ΄Ͳࡌ͍ͤͯͨهࣄʹ͑͋Δ
0QBRVF3FTVMU5ZQF w ύϑΥʔϚϯε্ͷϩε͕ൃੜ͢Δɻ 1SPUPDPMͰͷฦΓʹ͢Δͱ༧ظ͞ΕΔશͯͷܕʹ ରԠՄೳͳΑ͏ʹϝϞϦྖҬ͕֬อ͞ΕΔ
ؔͷฦΓͰҰߦͰࡁΉ߹ʹ ASFUVSOAΛॻ͔ͳͯ͘Α͘ͳͬͨ func add(x: Int, y: Int) -> Int {
x + y } ͦͷ·Μ·Ͱ͢ɻ ࠓ·ͰΫϩʔδϟͰͰ͖ͨͷ͕ͦͷ··ؔͰͰ͖ΔΑ͏ ʹͳΓ·ͨ͠ɻ
ͦͷଞؾʹͳΔΞοϓσʔτ w $PSF/'$Ͱ4VJDBͳͲͷಡΈऔΓ͕Մೳʹͳͬͨ ˠJ1IPOFʹ4VJDBOBOBDPΛ͚ۙͮΔ͚ͩͰߴͷ֬ೝ ͕Ͱ͖Δʂʂ w EZOBNJD.FNCFS-PPLVQͷ,FZ1BUIରԠ
͓·͚ IUUQTHJUIVCDPNSZJUUPFWFSZUIJOH@DPVOUFS
͋Γ͕ͱ͏͍͟͝·͠ ͨʂʂ