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 like this image
I try to add padding to the top but it shows this weird issue like this
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 {
ForEach(model.songs) { song in
NavigationLink(destination: DetailView(song: song)) {
songRow(song: song)
}
}
.listStyle(.plain)
}
.padding(.top, 50)
.navigationBarTitle(Text("My Music"))
}
.accentColor(.white)
}
}
extension UIColor {
static let myCustomColor = UIColor(#colorLiteral(red: 0, green: 0.4916731715, blue: 1, alpha: 0.3263276076))
static let myCustomColor2 = UIColor(#colorLiteral(red: 0, green: 0.4894992709, blue: 1, alpha: 0.8824244619))
}