Post

Replies

Boosts

Views

Activity

Reply to Toolbar Roles behavior
I have find some changes when pushing a navigationLink. In I understanding, browsing role let you know the page you came from, so you will get a great experience across different pages just like a browser. The Editor rule let you focus on a single view so that it will not show you where you came from when you're in a new view. It would just show a "back"(<) symbol.
Jun ’22
Reply to .backgroundTask in SwiftUI cannot compile
Beta 4 is out. I have tried that again, but unfortunately it fails again. I checked the docs, .backgroundTask support macOS 13.0+ Beta. And I also have a question about how to back support iOS 15.0 while using this modifier, because I cannot use if-condition to switch between different WindowsGroups inside the Scene(I got a compile error)
Jul ’22
Reply to .backgroundTask in SwiftUI cannot compile
This can compile: WindowGroup {     ContentView() // <-- If we only have one line of code, it works. } .backgroundTask(.appRefresh("task")) {  } But this can't😒😒😒 WindowGroup {     ContentView() .environment(\.managedObjectContext, persistenceController.container.viewContext) // <-- We have modifier(s) here, it fails. } .backgroundTask(.appRefresh("task")) {  } Please fix this issue!!!! HELP!!! @eskimo Is yours the same?? @javiermares
Aug ’22
Reply to Add multiple events to the Calendar with Concurrency
After a long time researching every aspect of the code. I found that the problem is try eventStore.save(courseEvent, span: .futureEvents). Alternatively, I use try eventStore.save(..., span: ..., commit: false) and eventStore.commit() to solve the problem. I think this is caused by the data races because I'm using swift concurrency. While one event is saving, another one calls save method to save again, leading to data conflicts (just my guess.) To solve this, luckily, we can commit a batch of events later using eventStore.commit() to avoid data conflicts. The result is what I expected !!🥳 And after that optimization, the performance of this function is up to 25% faster (exactly 136ms faster). (haha. Perfect.) Final Code (in Swift 5.7): func export_test() { Task.detached { await withTaskGroup(of: Void.self) { group in for i in 0...15 { group.addTask { print("Task \(i): Start") let courseEvent = EKEvent(eventStore: eventStore) courseEvent.title = "TEST" courseEvent.location = "TEST LOC" courseEvent.startDate = .now courseEvent.endDate = .now.addingTimeInterval(3600) courseEvent.calendar = eventStore.defaultCalendarForNewEvents courseEvent.addRecurrenceRule(EKRecurrenceRule(recurrenceWith: .daily, interval: 1, end: nil)) try eventStore.save(courseEvent, span: .futureEvents, commit: false) } } } eventStore.commit() } }
Dec ’22