My view isn't displaying the Navigation Title and I can't change the background colour

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:
Code Block
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
With using your code exactly as is --
  • Navigation Title is shown correctly

  • It is not clear on which element you have tried to add gradient background

As far as I know, SwiftUI List (at least in iOS) covers its background with some default color, so usual ways which are effective to other views would not work.

Can you show enough code to reproduce the issue?
Including view hierarchy to your SettingsView and ZStack{ LinearGradient....
My view isn't displaying the Navigation Title and I can't change the background colour
 
 
Q