SwiftUI: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 54: Line 54:


| valign="top" |
| valign="top" |
* [https://www.hackingwithswift.com/books/ios-swiftui/why-does-self-work-for-foreach Why does \.self work for ForEach?]
* [https://stackoverflow.com/questions/56437036 Change the background color of a View]
* [https://www.hackingwithswift.com/books/ios-swiftui/why-does-self-work-for-foreach Why does <code>\.self</code> work for ForEach?]
* [https://www.hackingwithswift.com/quick-start/swiftui/how-to-create-views-in-a-loop-using-foreach Create view using ForEach]
* [https://www.hackingwithswift.com/quick-start/swiftui/how-to-create-views-in-a-loop-using-foreach Create view using ForEach]
* [https://www.hackingwithswift.com/books/ios-swiftui/creating-views-in-a-loop Creating views in a loop]
* [https://www.hackingwithswift.com/books/ios-swiftui/creating-views-in-a-loop Creating views in a loop]


|}
|}

Revision as of 03:46, 31 December 2019

ContentView

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack(alignment: .leading) {
            Text("Turtle Rock")
                .font(.title)
            HStack {
                Text("Joshua Tree National Park")
                    .font(.subheadline)
                Spacer()
                Text("California")
                    .font(.subheadline)
            }
        }
        .padding()
    }
}

struct ContentView_Preview: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

References