Skip to content

Instantly share code, notes, and snippets.

@mattyoung
Last active September 3, 2021 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattyoung/0b5f6d7439be3cdd309884bb9a5877d1 to your computer and use it in GitHub Desktop.
Save mattyoung/0b5f6d7439be3cdd309884bb9a5877d1 to your computer and use it in GitHub Desktop.
import SwiftUI
struct Child: View {
var body: some View {
ScrollView(.vertical, showsIndicators: true) {
ForEach(1...100, id: \.self) {
Text("#\($0) Hello, world!")
.padding()
}
}
.navigationTitle(Text("Child Title"))
// .navigationBarTitle(Text("Child Title"))
.navigationBarTitleDisplayMode(.inline)
// .toolbar {
// ToolbarItem(placement: .principal) {
// Text("Child TItle")
// }
// }
}
}
struct ContentView: View {
var body: some View {
NavigationView {
ScrollView(.vertical, showsIndicators: true) {
ForEach(1...100, id: \.self) {
Text("#\($0) Hello, world!")
.padding()
}
}
.navigationTitle(Text("Parent Title"))
// .navigationBarTitle(Text("Parent Title"))
.toolbar {
// ToolbarItem(placement: .principal) {
// Text("Parent Title")
// }
ToolbarItem(placement: .automatic) {
NavigationLink("Go", destination: Child())
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment