I am trying to make sure the Navigation Title (in large title display mode) and various headings/elements below on the page of my iOS app line up, essentially having the same leading padding. The two approaches I can think of are:
Essentially get/set the spacing represented by the red line in the attached image below. I haven't been successful in either of the options. Does anyone know how to do this?
I don't know how to get the actual value, but I believe that it's just the default padding amount.
import SwiftUI
struct ContentView: View {
@State private var text: String = ""
@State private var searchString = ""
var body: some View {
NavigationView {
VStack(alignment: .leading) {
Text("some text")
List {
Text("Item 1")
}
.searchable(text: $searchString)
Text("some more text")
}
.padding(.horizontal)
.navigationTitle("Title")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With