Post

Replies

Boosts

Views

Activity

Reply to New Swiftui Text timer not counting down
Text(.now, format:.timer(countingDownIn: Date.now..<Date.now.addingTimeInterval(120), showsHours: true, maxFieldCount: 2, maxPrecision: .seconds(60)) ) Using Date.now here confused me 🤔. The first argument .now will be evaluated when the view body is updated, in a very unpredictable way. The text will stay on the last view update time. I think this new API should be used in this way: @State private var date: Date = .now var body: some View { Text(date, format: .timer(...)) .onReceive(Timer.publish(/* on every seconds */)) { date = $0 } } UPDATE: Found: https://developer.apple.com/documentation/swiftui/timedatasource/currentdate Simply change Date.now to TimeDataSource<Date>.currentDate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’24
Reply to JSONEncoder: How to sort keys using "localizedStandardCompare"? (just like how Xcode 16 serialize a xcstrings file)
@DTS Engineer @Developer Tools Engineer Thank you for your fast response and detailed information! ❤️ After further investigation, I found the implementation of JSONSerialization seems to be incorrect. When using .sortedKeys options with JSONSerialization, the keys are always sorted in the "Finder-like" order instead of lexicographic order. This is inconsistent with the documentation. But I'm not sure what is the expected behavior. I can reproduce this issue with Xcode 16.0 on the latest macOS 15.0 and iOS 18.0. I've submitted a feedback FB15177571.
Topic: App & System Services SubTopic: General Tags:
Sep ’24
Reply to StoreKit Causing Unrelated SwiftUI View to Freeze
Might be relevant: Cannot load cross-import overlay for 'StoreKit' and 'SwiftUI': Input/output error (declared by '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/System/iOSSupport/System/Library/Frameworks/StoreKit.framework/Modules/StoreKit.swiftcrossimport/SwiftUI.swiftoverlay')
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to Emojis are not properly rendered in accented widgets on iOS 18
Workaround: Convert to image. // widgetRenderingMode == .accented Image(uiImage: "😄".toImage(fontSize: size)) .resizable() .scaledToFit() .luminanceToAlpha()
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to Wrong unit in HIG > Components > System Experiences > Widget > watchOS widget dimensions
FB14985926
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to New Swiftui Text timer not counting down
Text(.now, format:.timer(countingDownIn: Date.now..<Date.now.addingTimeInterval(120), showsHours: true, maxFieldCount: 2, maxPrecision: .seconds(60)) ) Using Date.now here confused me 🤔. The first argument .now will be evaluated when the view body is updated, in a very unpredictable way. The text will stay on the last view update time. I think this new API should be used in this way: @State private var date: Date = .now var body: some View { Text(date, format: .timer(...)) .onReceive(Timer.publish(/* on every seconds */)) { date = $0 } } UPDATE: Found: https://developer.apple.com/documentation/swiftui/timedatasource/currentdate Simply change Date.now to TimeDataSource<Date>.currentDate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to App is crashing when using "withCheckedContinuation" in Xcode 16 beta 5
Same here. But seems only happening on previous iOS 18.0 22A5307f and 22A5316j.
Replies
Boosts
Views
Activity
Sep ’24
Reply to Tapping tab icon causes incorrect navigation title layout in SwiftUI on iOS 18
FB15038185
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Unable to Launch Tests/UITests in Xcode 16 with iOS 18 Simulator
xcrun simctl delete all This resolved the issue. However, you need to manually add all the simulators after this.
Replies
Boosts
Views
Activity
Sep ’24
Reply to Unable to scroll the list under View.safeAreaInset()
FB15078533
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Tab button's ax identifier is missing when using `.sidebarAdaptable` TabViewStyle
FB15125912 @DTS Engineer Thanks!!🙏
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to JSONEncoder: How to sort keys using "localizedStandardCompare"? (just like how Xcode 16 serialize a xcstrings file)
PS: Only Xcode 16 serializes the String Catalog files into the "Finder-like" order. In Xcode 15, the String Catalog files are in lexicographic order. So, this is a new in Xcode 16.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to JSONEncoder: How to sort keys using "localizedStandardCompare"? (just like how Xcode 16 serialize a xcstrings file)
@DTS Engineer @Developer Tools Engineer Thank you for your fast response and detailed information! ❤️ After further investigation, I found the implementation of JSONSerialization seems to be incorrect. When using .sortedKeys options with JSONSerialization, the keys are always sorted in the "Finder-like" order instead of lexicographic order. This is inconsistent with the documentation. But I'm not sure what is the expected behavior. I can reproduce this issue with Xcode 16.0 on the latest macOS 15.0 and iOS 18.0. I've submitted a feedback FB15177571.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Unable to Launch Tests/UITests in Xcode 16 with iOS 18 Simulator
@Developer Tools Engineer FB15244277
Replies
Boosts
Views
Activity
Sep ’24
Reply to SFSpeechRecognizer is broken on iOS 18
FB15290642
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to App Intents: How to test intent donation using IntentDonationManager?
Update On iOS 18, AppShortcutProvider+AppIntent+IntentDonationManager can reliably make the system display the corresponding shortcuts in Spotlight. This works on both the simulator and real devices.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to StoreKit Causing Unrelated SwiftUI View to Freeze
FB15932459
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to StoreKit Causing Unrelated SwiftUI View to Freeze
Might be relevant: Cannot load cross-import overlay for 'StoreKit' and 'SwiftUI': Input/output error (declared by '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/System/iOSSupport/System/Library/Frameworks/StoreKit.framework/Modules/StoreKit.swiftcrossimport/SwiftUI.swiftoverlay')
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24