SwiftUIのライブコーディングす るとxcodeが◯回落ちる

SwiftUIのライブコーディングす るとxcodeが◯回落ちる

SwiftUIが発表されたWWDC2019初期から間もないプレゼンテーション資料。beta版のxcodeで実際に実演したところ表題通りxcodeが途中終了してしまった。

0fb0b8c6eecbc8e0a3981501f6a6fea6?s=128

notoroid

July 27, 2019
Tweet

Transcript

  1. 10.

    4XJGU6* w 4XJGUϕʔεͷ6*࡞੒ϑϨʔϜϫʔΫ w %4- ༻్ൣᙝݻ༗ݴޠ ͕4XJGUͰهड़Ͱ͖Δ w 4XJGUΛ%4-ʹدͤͨ w

    6*Λߏ੒͢Δجຊఆٛ͸7JFX w 7JFXΛએݴత %FDMBSBUJWF ʹهड़Ͱ͖؆ܿͳهड़͕Մೳ
  2. 32.
  3. 34.
  4. 38.

    ϨΪϡϨʔγϣϯ 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Λ࢖༻
  5. 39.
  6. 40.

    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*ͷςϯϓϨʔτίʔυ 7JFX͸CPEZͰͭͷ7JFXΛ೿ੜ ͨ͠એݴΛ౉͢ඞཁ͕͋Δɻ
  7. 57.

    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") )
  8. 58.

    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) }