Hey, what is the best way to do something similar in the SwiftUI world? I'm trying to stop the title being affected by scrolling a list with a static header.
In this example scrolling the list pulls the title down over "Heading", which remains static. Ideally the title wouldn't be affected.
Many thanks in advance
extension String: Identifiable {
public var id: Int {
hashValue
}
}
struct ContentView: View {
static let items = ["a", "b", "c"]
var body: some View {
NavigationStack {
VStack {
Text("Heading")
List(ContentView.items) { item in
Text(item)
}
.listStyle(.plain)
.navigationTitle("Title")
}
.padding()
}
}
}
#Preview {
ContentView()
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: