I'm trying to change the background colour to a gradient which I have done on other views in this app using ZStack{
LinearGradient(gradient: Gradient(colors: [.purple, .blue]), startPoint: .top, endPoint: .bottom).
The page in question is below:
import SwiftUI
struct SettingsView: View {
@StateObject private var viewModel = SettingsViewModel()
var body: some View {
List(viewModel.itemViewModels.indices, id: \.self) { index in
Button {
viewModel.tappedItem(at: index)
} label: {
HStack{
Image(systemName: viewModel.item(at: index).iconName)
Text(viewModel.item(at: index).title)
}.background(Color.green)
}
}
.navigationTitle("Settings")
.background(
NavigationLink(
destination: LoginSignupView(
viewModel: .init(
mode: .signup,
isPushed: $viewModel.loginSignupPushed
)
),
isActive: $viewModel.loginSignupPushed){
}
)
.onAppear {
viewModel.onAppear()
}
}
}
Any help is appreciated
Post
Replies
Boosts
Views
Activity
I've tried numerous methods on the internet but none have worked. Can anybody help? It seems impossible
The trailing navigation bar items are working but the leading ones just do not show up at all. What is the solution?
I've got multiple pages / views in my app (using Swift UI). But after I have navigated to my third view using navigation links the back button is coming further and further down the screen vertically. I am essentially losing space to work with in my views with every link I use. What is the solution to this?