I have 2 views in my code, a VStack and then a custom view.
I am adding an offset to the second view of -75, to move it on top of the first view.
Here is my current code:
Group {
VStack {
//First View
VStack {
Image("LogoCrest")
NavigationLink(destination: LocationSearch()) {
Text("Find a location")
.foregroundColor(Color.white)
.bold()
.padding()
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.center)
.background(Color(red: 81 / 255, green: 175 / 255, blue: 67 / 255))
.cornerRadius(7)
.padding()
}
.padding(.top, 75)
.padding(.bottom, 75)
.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.center)
.background(Color(red: 49 / 255, green: 49 / 255, blue: 49 / 255))
//Second view
CircuitList(Circuits: Circuits)
.offset(y: -75)
.padding()
}
}
.background(Color(red: 232 / 255, green: 232 / 255, blue: 232 / 255))
.edgesIgnoringSafeArea(.top)
How can I increase the height of the second view so it can always be at the bottom (see the black line in the image below for my desired extra height)?
I have found the answer.
Since I added y:-75
offset to my view, I had to add y:-75
padding too.
CircuitList(Circuits: Circuits)
.offset(y: -75)
.padding()
.padding(.bottom, -75)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With