Thanks for your response.
I do have a NSFilePresenter on a parent folder and get notifications for changes in the subfolder from this one. But it does not trigger any updates that I would see. It does get called, though, after I have opened the files app and the system learns about the newly added files.
Would I need another NSFilePresenter on each subfolder?
[quote='796008022, Engineer, /thread/759719?answerId=796008022#796008022']
Some FileProvider applications will use this upcall as a hint, to refresh the latest state from their server.
[/quote]
Does that mean that in the end it would have to be the FileProvider that needs to provide support? I'm curious about how the Files app (and other apps) trigger the update.
Post
Replies
Boosts
Views
Activity
5. Buttons in the Sidebar
We could add buttons to the sidebar:
struct SidebarButtonsAndStackSelection: View {
@State var selection: Int?
@State var path: [Int] = []
var body: some View {
NavigationSplitView {
List(1...20, id: \.self) { number in
Button("I like \(number)") {
path.append(number)
}
}
} detail: {
NavigationStack(path: $path) {
List(1...20, id: \.self, selection: $selection) { number in
Text("I like \(number)")
}
.padding()
.navigationDestination(for: Int.self) { number in
VStack {
Text("You chose \(number)")
List(1...20, id: \.self, selection: $selection) { number in
Text("I like \(number)")
}
}
}
}
}
.onChange(of: selection) { newValue in
print("You clicked \(newValue)")
if let newValue {
path.append(newValue)
}
}
.onChange(of: path) { newValue in
print("Path changed to \(path)")
}
}
}
This initially works but after clicking around a bit the CPU goes up to 100 percent and the app freezes.
Am I doing anything wrong? Or is the combination of NavigationStack and NavigationSplitView super buggy?
Is this still working for you? When I click on a link in the detail view the app freezes and CPU goes up to 100 percent. If I read the SwiftUI instruments correctly the NavigationStack is constantly redrawn.