로고조성현

SwiftUI

SwiftUI Overview - Xcode - Apple Developer

  • SwiftUI App abides by the App Protocol.
  • Structure Body returns 1 or more scenes.
  • @main marks the entry point of the app.
  • I like how it is declarative
import SwiftUI

struct LandmarkDetail: View {
    var body: some View {
        Text("Hello, World!")
    }
}

struct LandmarkDetail_Previews: PreviewProvider {
    static var previews: some View {
        LandmarkDetail()
    }
}
struct LandmarkRow_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            LandmarkRow(landmark: landmarks[0])
            LandmarkRow(landmark: landmarks[1])
        }.previewLayout(.fixed(width: 300, height: 70))
    }
}
Text("Turtle Rock").font(.title)