Below is my code to make a View in SwiftUI. I want to position my Welcome button to the bottom of the screen as shown below.
struct welcomeViewControllerView: View {
var body: some View {
Text("Welcome")
.font(.system(size: 20, design: .rounded))
.padding(.leading)
.multilineTextAlignment(.center)
.background(
Image("splashBackground")
.resizable()
.edgesIgnoringSafeArea(.all)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
Button(action:{print("button pressed")})
{
Text("Continue")
.font(.system(size: 20, design: .rounded))
.foregroundColor(.black)
.frame(width: 300, height: 50, alignment: .center)
.background((Image("buttonImage")).resizable().frame(width: 300, height: 50, alignment: .center))
}
}
}
class welcomeViewController: UIHostingController<welcomeViewControllerView> {
required init?(coder: NSCoder)
{
super.init(coder: coder,rootView: welcomeViewControllerView());
}
override func viewDidLoad()
{
super.viewDidLoad()
view.backgroundColor = .white
}
}
How can I position my button to the bottom of the screen? I posted the screen below. I am fairly new to using SwiftUI.