Hello,
I would like tow have a large navigationTitle style after going back from the sub view. The issue is caused by the searchable modifier.
import SwiftUI
struct SearchTest: View {
@State var query: String = ""
var body: some View {
List {
NavigationLink("One") {
Text("I need a large navigation title...")
}
}
.searchable(text: $query, placement: .navigationBarDrawer(displayMode: .always))
.navigationTitle("Test")
}
}
struct SearchTest_Previews: PreviewProvider {
static var previews: some View {
NavigationStack {
SearchTest()
}
}
}
Post
Replies
Boosts
Views
Activity
Hello,
I would like that the navigation title "View 1" stays large after going to a subview and back.
The problem only occurs with a searchable modifier with the always shown settings. Any ideas?
struct NavigationTestView: View {
var body: some View {
TabView {
NavigationStack {
List {
NavigationLink {
Text("Sub View")
.navigationTitle("View 2")
} label: {
Text("press me")
}
}
.navigationTitle("View 1")
.searchable(text: .constant(""), placement: .navigationBarDrawer(displayMode: .always))
}
.tabItem {
Label("TestView", systemImage: "testtube.2")
}
}
}
}
struct NavigationTestView_Previews: PreviewProvider {
static var previews: some View {
NavigationTestView()
}
}
Hello,
is there a way to set the focus on the search bar without the user clicking on it?
Just like with the @FocusState for Textfields but for the new .searchable modifier.
Thanks,
Jonas
Hello,
i would like to have the sidebar items highlighted transparently just like in the Finder or Music app.
I tried to change the accent color and also have the list style as SidebarListStlye().
Best Regards
Jonas
Hello,
I am trying to use a NavigationLink in my macOS app. The problem is that the destination View is shown as a "speech bubble" and not as new normal View in the app.
Here is a sample code to replicate the problem...
import SwiftUI
struct MainView: View {
var body: some View {
NavigationView {
Text("Sidebar")
NavigationLink(destination: SubView()) {
Text("click me")
}
}
}
}
struct SubView: View {
var body: some View {
Text("Hello, World!")
}
}
// Preview
struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView()
}
}
If the NavigationLink is in the Sidebar it works as intended (normal new View)
I opened the Session1 - Part1 - End file.
In the "GardenDetail" view in the "Navigation" Folder of the project Xcode throws the error "cannot find 'Table' in scope".
I did not changed anything from the original tutorial and have Xcode 13 and BigSur 11.6 on a M1 Mac.