Hello Surikata. Unfortunately, I currently unable to solve my problem... I keep looking for a solution and I'll keep you in touch if I find anything useful. I hope someone will help us here.
Post
Replies
Boosts
Views
Activity
Hi !
Pros for SwiftUI: Clean code, declarative way, reactive.
Cons: Still young, you'll have to use UIKit wrapped in SwiftUI for some components.
Anyway, I highly recommend you to start to learn SwiftUI because it will be a standard soon for Apple app development.
I hope this helps !
Have a nice day !
Thank you for your answer MobileTen.
Actually, looking Fruta sample code, I already tried to use selection. Here is what I got:
@State private var selection: String?
var body: some View {
NavigationView {
List {
NavigationLink(destination: DetailView(), tag: "1", selection: $selection) {
Label("Item 1", systemImage: "house")
}
NavigationLink(destination: DetailView(), tag: "2", selection: $selection) {
Label("Item 2", systemImage: "house")
}
NavigationLink(destination: DetailView(), tag: "3", selection: $selection) {
Label("Item 3", systemImage: "house")
}
}
.listStyle(SidebarListStyle())
}
}
Once on my Detail view, here is my code:
var body: some View {
VStack {
Spacer()
NavigationLink(destination: Text("Hello")) {
Text("Touch me")
}
Spacer()
}
}
But when I tap on the "Touch me" navigation link, the item in sidebar become unselected. Am I doing it right ?
It's pretty weird because this behavior seems to appear only on iPadOS 15, I did not have the problem on iPadOS 14.