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
340
SwiftUIのライブコーディングす るとxcodeが◯回落ちる
SwiftUIが発表されたWWDC2019初期から間もないプレゼンテーション資料。beta版のxcodeで実際に実演したところ表題通りxcodeが途中終了してしまった。
notoroid
July 27, 2019
Tweet
Share
More Decks by notoroid
See All by notoroid
AppIntentsの用途 - AppleのGPT元年
notoroid
1
97
Privacy manifests - Appleと開発コミュニティ
notoroid
1
150
とっさのAutoLayout - Rewind autolayout
notoroid
0
47
UVC(USB video class)と マルチプラットフォーム - UVC support by Apple multiplatform
notoroid
0
240
SwiftUIむけに 整理された状態監視 Observation
notoroid
0
580
よせあつめSwift - Swift5.9
notoroid
1
590
Transferable - SwiftUI ドキュメントアプリ
notoroid
2
360
整理されたSwift言語仕様 - Swift 5.7 any/some
notoroid
1
910
Swift Concurrencyの 尻尾を掴め ~ 並行処理を受け入れる取っ掛かり
notoroid
1
410
Other Decks in Programming
See All in Programming
ドメイン駆動設計を実践するために必要なもの
bikisuke
4
340
The Sequel to a Dream of Ruby Parser's Grammar
ydah
1
220
2024 컴포즈 정원사
jisungbin
0
150
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
0
230
Composing an API the *right* way (Droidcon New York 2024)
zsmb
2
180
Architecture Decision Record (ADR)
nearme_tech
PRO
1
700
How to Break into Reading Open Source
kaspth
2
220
What is Parser
yui_knk
9
4.2k
Scala アプリケーションのビルドを改善してデプロイ時間を 1/4 にした話 | How I improved the build of my Scala application and reduced deployment time by 4x
nomadblacky
1
180
マルチモジュールにおけるテスト最適化
fxwx23
0
210
GraphQL あるいは React における自律的なデータ取得について
quramy
11
3k
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
300
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
Building a Modern Day E-commerce SEO Strategy
aleyda
36
6.8k
Building an army of robots
kneath
302
42k
Documentation Writing (for coders)
carmenintech
65
4.3k
Ruby is Unlike a Banana
tanoku
96
11k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
230
17k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
36
1.7k
The World Runs on Bad Software
bkeepers
PRO
64
11k
Building a Scalable Design System with Sketch
lauravandoore
458
32k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Building Adaptive Systems
keathley
36
2.1k
Speed Design
sergeychernyshev
22
430
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*ྲྀ͠ࠐΉσʔλιʔε͋Γ͖ͳͷͰϞοΫΞοϓ༻ͷσʔλ ४උͨ͠΄͏͕͍͍͔