0

I am trying to increase the space between my navigationBarTitle and navigationView where my list is but it's not working. My list is attached to the navbar

I try to add padding to the top but it shows this weird issue

Here is the code

import SwiftUI
let coloredNavAppearance = UINavigationBarAppearance()
struct ContentView: View {

@EnvironmentObject var model: SongViewModel

init() {
UITableView.appearance().backgroundColor = .myCustomColor
coloredNavAppearance.configureWithOpaqueBackground()
coloredNavAppearance.backgroundColor = .myCustomColor2
coloredNavAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
coloredNavAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
UINavigationBar.appearance().standardAppearance = coloredNavAppearance
UINavigationBar.appearance().scrollEdgeAppearance = coloredNavAppearance
}
var body: some View {
NavigationView {
    List(model.songs) { song in
        NavigationLink(destination: DetailView(song: song)) {
            songRow(song: song)
        }
        .listStyle(.plain)
    }
    .padding(.top, 50)
    .navigationBarTitle(Text("My Music"))
}
.accentColor(.white)
}
}

And here is an image of that weird issue The weird white space comes

Could someone please give me a solution for this?

  • 2
    You already asked this question and was answered, and then deleted it... who after that would want to help you do you think? – Asperi Jul 12 '22 at 08:09
  • Yes but I asked it again because the questions answer got deleted and I accidentally made some changes to my app and lost that solution. That's why I had to ask again. Sorry I am a relatively new coder to Swift and Stackoverflow also. – Pavi Singh Jul 12 '22 at 08:10

0 Answers0