I want to fill the remaining white space with one color but i can't find any way to do that and i'm beginner on ios development
Photo of my app:
I want to fill the remaining white space with one color but i can't find any way to do that and i'm beginner on ios development
Photo of my app:
Using the property .ignoresSafeArea() on your view can expand the boundaries of your settings view outside of the safe areas.
The documentation can be found here
Put your content into a ZStack
and use a view with .ignoresSafeArea(.all)
as background.
struct MainView: View {
var body: some View {
ZStack {
GradientBackground(colors: [.red, .green])
.edgesIgnoringSafeArea(.all)
VStack(alignment: .leading) {
HStack {
Text("Setttings")
.foregroundColor(.white)
.font(.title)
.bold()
Spacer()
}
.padding(16)
.background(Rectangle().fill(Color.blue))
Spacer()
}
}
}
}
struct GradientBackground: View {
let colors: [Color]
var body: some View {
LinearGradient(gradient: .init(colors: colors), startPoint: .top, endPoint: .bottom)
}
}