Tag: SwiftUI/日本語チュートリアル1
struct ContentView: View { var body: some View { Text("Hello SwiftUI!") .padding() } }
struct ContentView: View { var body: some View { Text("Hello SwiftUI!") .font(.title).foregroundColor(.green) } }
struct ContentView: View { var body: some View { VStack{ Text("Turtle Rock") .font(.title) Text("Joshua Tree National Park") } } }
struct ContentView: View { var body: some View { VStack(alignment: .leading) { Text("Turtle Rock") .font(.title) Text("Joshua Tree National Park") .font(.subheadline) } } }
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() } }
import SwiftUI struct CircleImage: View { var body: some View { Image("turtlerock") } } struct CircleImage_Previews: PreviewProvider { static var previews: some View { CircleImage() } }
struct CircleImage: View { var body: some View { Image("turtlerock") .clipShape(Circle()) } }
import SwiftUI import MapKit struct MapView: View { @State private var region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868), span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2) ) var body: some View { Map(coordinateRegion: $region) } }
struct ContentView: View { var body: some View { VStack { MapView() .frame(height: 300) CircleImage() .offset(y: -130) .padding(.bottom, -130) VStack(alignment: .leading) { Text("Turtle Rock") .font(.title) HStack { Text("Joshua Tree National Park") .font(.subheadline) Spacer() Text("California") .font(.subheadline) } } .padding() } } }