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
SwiftUIのライブコーディングす るとxcodeが◯回落ちる
Search
notoroid
July 27, 2019
Programming
2
360
SwiftUIのライブコーディングす るとxcodeが◯回落ちる
SwiftUIが発表されたWWDC2019初期から間もないプレゼンテーション資料。beta版のxcodeで実際に実演したところ表題通りxcodeが途中終了してしまった。
notoroid
July 27, 2019
Tweet
Share
More Decks by notoroid
See All by notoroid
WeatherKit iOS18 update - お天気の更新
notoroid
0
37
AppIntentsの用途 - AppleのGPT元年
notoroid
1
120
Privacy manifests - Appleと開発コミュニティ
notoroid
1
180
とっさのAutoLayout - Rewind autolayout
notoroid
0
71
UVC(USB video class)と マルチプラットフォーム - UVC support by Apple multiplatform
notoroid
0
280
SwiftUIむけに 整理された状態監視 Observation
notoroid
0
650
よせあつめSwift - Swift5.9
notoroid
1
620
Transferable - SwiftUI ドキュメントアプリ
notoroid
2
390
整理されたSwift言語仕様 - Swift 5.7 any/some
notoroid
1
960
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
3
1.2k
CSC509 Lecture 13
javiergs
PRO
0
110
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
最新TCAキャッチアップ
0si43
0
200
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Ethereum_.pdf
nekomatu
0
470
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.3k
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Making Projects Easy
brettharned
115
5.9k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
110
Faster Mobile Websites
deanohume
305
30k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
The Invisible Side of Design
smashingmag
298
50k
Documentation Writing (for coders)
carmenintech
65
4.4k
Bash Introduction
62gerente
608
210k
Ruby is Unlike a Banana
tanoku
97
11k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Transcript
4XJGU6*ͷϥΠϒίʔσΟϯά͢ ΔͱYDPEF͕̋ճམͪΔ ͜ΕͬͯτϦϏΞʹͳΓ·ͤΜ͔
ࣗݾհ
ೳొཁ !OPUPSPJE w J04ΞϓϦ։ൃऀ w ߸͍Γ·͢ిࢉاը w !OPUPSPJE w !JSJNBTV
w Fεϙʔπ
w 4XJGU6*ొ w 4XJGU6*ϥΠϒίʔσΟϯά w ·ͱΊ
͢ൣғ w 4XJGU6*5VUPSJBMTΛͬͨϥΠϒίʔσΟϯά w $SFBUJOHBOE$PNCJOJOH7JFXT w IUUQTEFWFMPQFSBQQMFDPNUVUPSJBMTTXJGUVJDSFBUJOHBOE DPNCJOJOHWJFXT w %SBXJOH1BUITBOE4IBQFT
w IUUQTEFWFMPQFSBQQMFDPNUVUPSJBMTTXJGUVJESBXJOHQBUIT BOETIBQFT
͞ͳ͍ൣғ w ը໘ભҠ w σʔλόΠϯσΟϯά w طଘ6*ͱͷΈ߹Θͤ w Ξχϝʔγϣϯ w
04͝ͱͷ4XJGU6*ͷద༻
4XJGU6*ొ
88%$ ։ൃऀʹΓࢁͷ༰
4XJGU6*
4XJGU6* w 4XJGUϕʔεͷ6*࡞ϑϨʔϜϫʔΫ w %4- ༻్ൣᙝݻ༗ݴޠ ͕4XJGUͰهड़Ͱ͖Δ w 4XJGUΛ%4-ʹدͤͨ w
6*Λߏ͢Δجຊఆٛ7JFX w 7JFXΛએݴత %FDMBSBUJWF ʹهड़Ͱ͖؆ܿͳهड़͕Մೳ
4XJGU6* w 4XJGUϕʔεͷ6*࡞ϑϨʔϜϫʔΫ w %4- ༻్ൣᙝݻ༗ݴޠ ͕4XJGUͰهड़Ͱ͖Δ w 4XJGUʹ༷ΛՃͯ͠%4-ʹدͤͯ͠·͏ w
6*Λߏ͢Δجຊఆٛ7JFX w 7JFXΛએݴత %FDMBSBUJWF ʹهड़Ͱ͖؆ܿͳهड़͕Մೳ
4XJGU6* w 4XJGUϕʔεͷ6*࡞ϑϨʔϜϫʔΫ w %4- ༻్ൣᙝݻ༗ݴޠ ͕4XJGUͰهड़Ͱ͖Δ w 4XJGUʹ༷ΛՃͯ͠%4-ʹدͤͯ͠·͏ w
6*Λߏ͢Δجຊఆٛ7JFX w 7JFXΛએݴత %FDMBSBUJWF ʹهड़Ͱ͖؆ܿͳهड़͕Մೳ Կ
એݴత %FDMBSBUJWF w ͋Δग़ྗΛಘΔʹ͋ͨͬͯͦΕΛ࡞͢Δํ๏Ͱͳ͘ɺग़ྗͷੑ࣭Λه ड़͢Δ͜ͱΛʮએݴܕʯͱশ͢Δ w એݴతϓϩάϥϛϯάͷʮએݴతʯͬͯʁ w
IUUQTTIIBUFOBEJBSZPSHFOUSZ w )5.-એݴత
"QQMFͱͯ͠
એݴతͳهड़ΛՄೳͱ͠ એݴతͳهड़ʹ׳Ε͍ͯΔ ࡞Γख 8FC։ൃऀ Λݺͼد͍ͤͨ
એݴతͳख๏Λఏڙ͢Δ͜ͱͰ ༷ʑͳ04 J04 NBD04 XBUDI04 Ͱ ಉ͡ख๏Λద༻Ͱ͖ΔΑ͏ʹ͍ͨ͠
"QQMFͷ4XJGU6*ಋೖ w એݴతͳهड़ΛՄೳͱ͠એݴతͳهड़ʹ׳Ε͍ͯΔ࡞ΓखΛݺͼد͍ͤͨ w એݴతͳख๏Λఏڙ༷͠ʑͳ04Ͱಉ͡ख๏Λద༻Ͱ͖ΔΑ͏ʹ͍ͨ͠ w *OUFSGBDFCVJMEFSͰͷ6*࡞͔ΒҎ্ܦͪٻΊΒΕΔͷΛఏڙ͠ ͨ
"QQMFͷ4XJGU6*ಋೖ w એݴతͳهड़ΛՄೳͱ͠એݴతͳهड़ʹ׳Ε͍ͯΔ࡞ΓखΛݺͼد͍ͤͨ w એݴతͳख๏Λఏڙ༷͠ʑͳ04Ͱಉ͡ख๏Λద༻Ͱ͖ΔΑ͏ʹ͍ͨ͠ w *OUFSGBDFCVJMEFSͰͷ6*࡞͔ΒҎ্ܦͪٻΊΒΕΔͷΛఏڙ͠ ͨ 8FC։ൃऀʹ·Ͱ։ൃऀͷؒޱΛ͛Δ
ैདྷͷ6*෦ 4UPSZCPBSE YJC Έ߹ΘͤՄೳ
04ʹ࠷దԽ͞ΕͨػೳΛ͜Ε·ͰͲ ͓ΓΞϓϦʹΈࠐΉ͜ͱͰ͖Δ
એݴతهड़ʹෳࡶͳػೳΛఏڙͰ͖Δ ͍͏ͱࢥ͍ग़͢
8FCϒϥβʔ 'MBTI લ
4XJGU6*ͱطଘ6*ϑϨʔϜϫʔΫڞଘ͠ ͭͭ4XJGU6*ͰϦϓϨʔεͰ͖Δ6* ؆ܿʹهड़Ͱ͖ΔΑ͏ʹͳΔ J04͔Βʜ
4XJGU6*ϥΠϒίʔσΟϯά
4XJGU6*؆ܿʹ هड़Ͱ͖Δͷ͕ڧΈ
ͱ͍͑ҙਤͨ͠ϨΠΞτ͕ ࡞Εͳ͚ΕʹͳΒͳ͍
ࠓճطଘͷ6*Λਅࣅͯ͠ΈΔ
ਅࣅ͢Δର λΠϦϯάϕʔεͷ6*
ਅࣅ͢Δ6*
(MPSJPVT#BUUFSZ w ·ͰͷόοςϦʔঢ়ଶΛͱഎܠ ৭Ͱݟ͘͢දࣔ w ΫϦʔϯͳΠϯλʔϑΣΠε w όοςϦʔঢ়ଶɺॆిঢ়ଶͷΈΛදࣔ w όοςϦʔ֬ೝ͍ͨ͠σόΠεΛট
w ·ͰొՄೳɻͭͷը໘Ͱ֬ೝͰ ͖·͢ɻ
࣮ࡍͷϨΠΞτΛݟͯΈΔ
None
ηϧ 4BGF"SFB·Ͱ ృΓͭͿ͠
None
όοςϦʔྔ ୯Ґ ࣌ؒຖάϥϑ ॆిঢ়ଶ ໊ ԁάϥσʔγϣϯ
(MPSJPVT#BUUFSZͷϨΠΞτ w ηϧ w ηϧຖʹόοςϦʔใ w ηϧͷഎ໘ʹάϥσʔγϣϯ w ηϧ4BGF"SFBΛग़͍ͯΔ
YDPEFͷ ςϯϓϨʔτ͔ΒσβΠϯΛ ͚ۙͮͯΈΔ
ϨΪϡϨʔγϣϯ w ϑΥϯταΠζ w ϑΥϯταΠζP⒎TFU w ϑΥϯτશମΦϑηοτ w άϥσʔγϣϯΧϥʔ
w $PMPS SFE HSFFO CMVF w άϥσʔγϣϯΧϥʔ w $PMPS SFE HSFFO CMVF w ԁάϥσʔγϣϯ։࢝ܘQYɺऴྃܘQY w ϓϩδΣΫτ໊.POJUPS w ΧελϜ7JFXɺ$POUFOU7JFXɺ.POJUPS7JFXɺ(SBQI7JFXΛ༻
7JFX
import SwiftUI struct ContentView: View { var body: some View
{ Text("Hello World") } } #if DEBUG struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } #endif 4XJGU6*ͷςϯϓϨʔτίʔυ 7JFXCPEZͰͭͷ7JFXΛੜ ͨ͠એݴΛ͢ඞཁ͕͋Δɻ
ΈࠐΈ7JFXੜ 5FYU *NBHF -JOFBS(SBEJFOU 3BEJBM(SBEJFOU 3FDU"OHMF $JSDMF &MMJQTF (FPNFUSZ3FBEFS "OHVMBS(SBEJFOU
$BQTVMF
ෳͷ7JFXΛஔ͢Δ߹ɺ 4UBDL )4UBDL 74UBDL ;4UBDL
)4UBDL HStack { RectAngle() .foregroundColor(Color.red) RectAngle() .foregroundColor(Color.green) RectAngle() .foregroundColor(Color.blue) }
ᶃ ᶄ ᶅ هड़ॱʹࠨ͔Βӈʹஔ ᶃ ᶄ ᶅ
74UBDL VStack { RectAngle() .foregroundColor(Color.red) RectAngle() .foregroundColor(Color.green) RectAngle() .foregroundColor(Color.blue) }
ᶃ ᶄ ᶅ هड़ॱʹ্͔ΒԼʹஔ ᶃ ᶄ ᶅ
;4UBDL ZStack { RectAngle() .foregroundColor(Color.red) RectAngle() .foregroundColor(Color.green) RectAngle() .foregroundColor(Color.blue) }
ᶃ ᶄ ᶅ هड़ॱʹԞʹஔ ᶃ ᶄ ᶅ
4UBDLͷஔ7JFXଆʹαΠζ ࢦఆ͕ͳ͍ݶΓഒஔ
٧ΊࠐΉ߹ 4QBDFS Λࢦఆ
7JFXFEHFT*HOPSJOH4BGF"SFB Λ ͏ͱ4BGF"SFBΛແࢹ͢ΔΑ͏ʹͳΔ
4UBDL )4UBDL 74UBDL )4UBDL Λ Θͳͯ͘ஔͰ͖Δ
7JFXʹஔ
7JFXʹஔ
CBDLHSPVOECPEZͷDMJQϑΟϧλʔʹ Өڹ͢Δɻ
CBDLHSPVOE7JFXDMJQ ͷ ݁Ռ͕ө͞ΕΔ
Rectangle() .fill( Color.clear ).background( എܠඳը͢ΔView ) .clipped()
ϥΠϒίʔσΟϯάத
Ϧιʔε w ϑΥϯταΠζ w ϑΥϯταΠζP⒎TFU w ϑΥϯτશମΦϑηοτ w άϥσʔγϣϯΧϥʔ
w άϥσʔγϣϯΧϥʔ
RadialGradient(gradient: .init(colors: [Self.gradientStart, Self.gradientEnd]), center: .init(x: 0.5, y: 0.5), startRadius:
50, endRadius: 150) .aspectRatio(contentMode: .fill) static let gradientStart = Color(red: 102.0 / 255, green: 196.0 / 255, blue: 66.0 / 255) static let gradientEnd = Color(red: 87.0 / 255, green: 161.0 / 255, blue: 58.0 / 255) // .previewDevice(PreviewDevice(rawValue: "iPhone 8") ) .previewDevice(PreviewDevice(rawValue: "iPhone X") )
import SwiftUI struct GraphView: View { var body: some View
{ HStack(spacing:0) { ForEach(0 ..< 12) { item in GraphLineView() } Spacer() } } } #if DEBUG struct GraphVioew_Previews: PreviewProvider { static var previews: some View { GraphView() // .previewDevice(PreviewDevice(rawValue: "iPhone 8") ) .previewDevice(PreviewDevice(rawValue: "iPhone X") ) } } #endif struct GraphLineView: View { var body: some View { ZStack { // Rectangle() // .foregroundColor(Color.green) ForEach(0 ..< 12 ) { item in GeometryReader { geometry in Path { path in let verticalOffset = 0.5 + (item == 0 ? 0 : (geometry.size.height * 0.2)) path.move( to: CGPoint( x: 0.5 + CGFloat(item) * 2.5, y: verticalOffset ) ) path.addLine( to: CGPoint( x: 0.5 + CGFloat(item) * 2.5, y: 0.5 + geometry.size.height ) ) } .stroke(Self.strokeColor, lineWidth: 1) } } }.frame(width:29.5, height:20) } static let strokeColor = Color(white: 1, opacity: 0.8) }
·ͱΊ w 4XJGU6*4XJGUͰهड़Ͱ͖Δ%4-Ͱ͋Δ4XJGUιʔείʔυͰ͢ w ͿΓʹ"QQMF͕ॏ͍ࠊΛ্͛ͯ৽͍͠։ൃऀͷݺͼࠐΈத w 4XJGU6*ͷϨΠΞτ8FCͷσβΠϯʹ͍͚ۙͲΫη͋Γ w 4XJGU6*ྲྀ͠ࠐΉσʔλιʔε͋Γ͖ͳͷͰϞοΫΞοϓ༻ͷσʔλ ४උͨ͠΄͏͕͍͍͔