Post

Replies

Boosts

Views

Activity

Reply to .sheet no longer dismissable in WatchOS 7?
In the latest beta (watchOS 7 Beta 6), it now appears that the "Cancel" button has reappeared on sheets and tapping on it will close the sheet. However, .sheet is still not dismissable in WatchOS 7 when the sheet .navigationBarTitle is set (e.g. to something more fitting for the context like "Back" or "Close"). Feedback has been filed (FB8535588)
Aug ’20
Reply to CloudKit not working properly in iOS 17 RC
I'm running into what sounds like a similar issue. CloudKit CoreData sync worked perfectly in iOS 16/watchOS 9, but is no longer working reliably in iOS 17/watchOS 10. Previously, the watchOS and iOS apps would be in sync within seconds, but now it takes hours. The iOS app seems to work better after a reinstall, but the watchOS app is unreliable. Even a with a delete and reinstall, it finally randomly syncs after minutes or hours and does not stay in reliably in sync afterward. Looking at the CloudKit live streaming log, iOS 17 seems to be quite active immediately when there is a database update to push, but watchOS 10 is inactive when it should be receiving or pushing an update. Appreciate any insights or experiences others might have. The same code across both apps has worked reliably since iOS 13/watchOS 6...until now.
Sep ’23
Reply to watchOS 10: CloudKit CoreData Sync (NSPersistentCloudKitContainer) Requires Watch on Charger
I have been able to fix iCloud CoreData sync by migrating my watch app from an extension to a single app using the upgrade process offered by Xcode. While CoreData CloudKit syncing is now working correctly, the migration has created a separate issue with CoreLocation as highlighted in another forum discussion: https://developer.apple.com/forums/thread/736785
Oct ’23
Reply to CloudKit stopped syncing on WatchOS
I had a similar issue with CoreData CloudKit sync on my watchOS app. I was able to fix it by migrating my watch app from an extension to a single app using the upgrade process offered by Xcode. Note that while CoreData CloudKit syncing is now working correctly, the migration has created a separate issue with CoreLocation as highlighted in another forum discussion: https://developer.apple.com/forums/thread/736785
Oct ’23
Reply to How to create a custom TimeDataSource?
I've been testing TimeDataSource in a similar attempt to get the Text view to update within a LiveActivity. From what I've found so far, you would be able to use something like this to reference your workoutStartDate: Text(TimeDataSource<Date>.durationOffset(to: workoutStartDate), format: .units(allowed: [.hours, .minutes], width: .narrow, fractionalPart: .hide(rounded: .down))) This creates an updating Duration based on the difference between the current time and the offset date and will work within a LiveActivity view (mostly)**. This formatting displays a timer that counts up from your workoutStartDate in Xm format. When reaching an hour, it would shift to Xh and subsequently Xh Xm. There's been a helpful resource created here that outlines FormatStyle options: https://goshdarnformatstyle.com/duration-styles/ **Within a regular app view, the timer value updates as expected...at the top of a new minute. However, I notice that the values seem to update inconsistently within a LiveActivity view like the Dynamic Island. If anyone has a fix for that, I'd love to see it.
3w
Reply to Live Activity compact timers
I too have been searching for a way to get a timer to show within a Live Activity view in a format like 3m or 3min as is shown in the Apple Documentation. From what I've found so far, the new TImeDataSource available in iOS 18 gets closest: Text(TimeDataSource<Date>.durationOffset(to: startDate), format: .units(allowed: [.hours, .minutes], width: .narrow, fractionalPart: .hide(rounded: .down))) This creates an updating Duration based on the difference between the current time and the offset date and will work within a LiveActivity view (mostly**). This example formatting displays a timer that counts up from your startDate Date in Xm format. When reaching an hour, it would shift to Xh and subsequently Xh Xm. There's a helpful resource created here that outlines FormatStyle options: https://goshdarnformatstyle.com/duration-styles/ **Within a regular app view, the timer value updates as expected...at the top of a new minute. However, I notice that the values seem to update inconsistently within a LiveActivity view like the Dynamic Island. If anyone has a fix for that, I'd love to see it. Other unsolved challenges: Because this requires TimeDataSource, it will not work with earlier iOS versions--I have not found an alternative there. The width of the generated Text frame is huge which creates a challenge, especially in compact Dynamic lsland views. The only way I've found to fit the timer is to use the TimeDataSource as an overlay above a hidden Text view. Unfortunately this approach makes it hard coded to a defined width so you either need to set your hidden Text to be the maximum potential timer width or push updates to redraw the Live Activity at key increments (e.g. 9m -> 10m, 60m to 1h, etc.) Text("0m") .hidden() .overlay(alignment: .leading) { Text(TimeDataSource<Date>.durationOffset(to: startDate), format: xxxxx) } You can use this to format a countdown timer to a future date, but there's seemingly no way to remove the preceding negative sign within FormatStyle. The example below would show a countdown timer in Xh Xm format, but always with a negative sign. Text(TimeDataSource<Date>.durationOffset(to: futureDate), format: .units(allowed: [ .minutes, .hours], width: .narrow, maximumUnitCount: 2, zeroValueUnits: .show(length: 1), valueLengthLimits: 2...3))
3w