Created
November 21, 2022 12:21
-
-
Save nikolovlazar/4cbfa053b0d866f9e7a47ee51157357a to your computer and use it in GitHub Desktop.
An example Modal UI built with SwiftUI.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: An example Modal UI built with SwiftUI | |
import SwiftUI | |
import PlaygroundSupport | |
struct ContentView: View { | |
@State private var emailAddress = "" | |
var body: some View { | |
VStack(spacing: 16) { | |
Image(systemName: "envelope.fill") | |
.font(.largeTitle).foregroundColor(.blue) | |
Text("Sign up to our newsletter!").font(.title).fontWeight(.bold) | |
Text("Since you love our content so much, why not get them every day in your inbox?") | |
.multilineTextAlignment(.center) | |
.foregroundColor(.secondary) | |
.frame(width: 400) | |
HStack(spacing: 0) { | |
TextField("john@doe.xyz", text: $emailAddress) | |
.frame(height: 40) | |
.padding(.leading, 12) | |
.border(.gray) | |
Button(action: { | |
// Handle onClick logic | |
}) { | |
Text("Subscribe") | |
.foregroundColor(.white) | |
} | |
.padding(.horizontal, 16) | |
.padding(.vertical, 10) | |
.background(.black) | |
} | |
.frame(width: 400) | |
} | |
.padding(40) | |
} | |
} | |
// Present the view controller in the Live View window | |
PlaygroundPage.current.setLiveView(ContentView()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment