When I scroll a List, I want to shrink the navigation bar from large to small. This works by default, but if I try to add a gradient behind the table, it doesn't work any more. Code is attached (try uncommenting the Gradient to see). How do I get this to work?
import SwiftUI
struct BuyView: View {
let numbers = ["1","2","4","1","2","4","1","2","4","1","2","4","1","2","4","1","2","4"]
init() {
UITableView.appearance().backgroundColor = .clear
UITableViewCell.appearance().backgroundColor = .clear
}
var body: some View {
NavigationView {
ZStack {
// LinearGradient(gradient: Gradient(colors: [.gray, .white]), startPoint: .top, endPoint: .bottom)
// .edgesIgnoringSafeArea(.all)
List(numbers, id: \.self) { number in
Text(number)
}.navigationBarTitle("Numbers")
}
}
}
}
struct BuyView_Previews: PreviewProvider {
static var previews: some View {
BuyView()
}
}