import SwiftUI
struct Calculate: View {
@State private var Salary = ""
@State private var Assets = ""
@State private var Liabilities = ""
@State var showDetails = false
var body: some View {
NavigationView {
VStack {
TextField("Your Salary", text: $Salary)
.keyboardType(.numberPad)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 8))
.cornerRadius(5)
.padding(.all, 15.0)
.background(Color.init(red: 50/255, green: 50/255, blue:50/255))
.offset(x: 0, y: -10)
TextField("Your Assets", text: $Assets)
.keyboardType(.numberPad)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 8))
.cornerRadius(5)
.padding(.all, 15.0)
.background(Color.init(red: 50/255, green: 50/255, blue:50/255))
.offset(x: 0, y: -35)
TextField("Your Liabilities", text: $Liabilities)
.keyboardType(.numberPad)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 8))
.padding(.bottom, 0)
.cornerRadius(5)
.padding(.all, 15.0)
.background(Color.init(red: 50/255, green: 50/255, blue:50/255))
.offset(x: 0, y: -50)
Button(action: {
self.showDetails.toggle()
}) {
Text(/*@START_MENU_TOKEN@*/"Button"/*@END_MENU_TOKEN@*/)
}
if showDetails {
Text("You have a net worth of " + "\(Assets) +- \(Liabilities)" + " dollars!")
}
else {
Text("Enter Some Numbers!")
}
}
.offset(x:0, y: -100)
}
}
}