Thanks.
I have filed the bug here: FB15774062
Post
Replies
Boosts
Views
Activity
Using a dedicated obervable object with a timer being initialized there will perfectly work while the open menu is blocking the runloop from SwiftUI.
public final class MyObject: ObservableObject {
@Published var showItem: Bool = false
var cancellable = Set<AnyCancellable>()
init() {
Timer.publish(every: 5, on: .main, in: .common)
.autoconnect()
.sink(receiveValue: { [weak self] value in
print(value)
self?.showItem = true
})
.store(in: &cancellable)
}
}
And within the MenuBarExtra content closure, you can use something like:
if myObject.showItem{
Button("Item 2") {
}
}
Updated link to the sample project: https://github.com/delawaremathguy/CoreDataCloudKitShare