Hello,
I'd like to ask a very fundamental question about JSONEncoder: how to sort keys in a specific order when encoding a dictionary to JSON text?
I know there is an option called JSONEncoder.OutputFormatting.sortedKeys, but it sorts the keys only in lexicographic order.
I want to sort the keys using a different comparator, such as String.localizedStandardCompare(_:), which achieves the "Finder-like" order.
The reason why I ask this question is because I have a localization tool that works with String Catalog (xcstrings file, which is a JSON), but every time my tool serializes an xcstrings file, it always messes up the keys in lexicographic order (I used JSONEncoder + .sortedKeys). Meanwhile, Xcode 16 always serializes the string keys into the "Finder-like" order. As a result, my tool always generates a huge diff when manipulating the xcstrings even when making only a small modification to it.
So I am wondering how Xcode 16 implements the String Catalog tool to serialize the JSON in "Finder-like" order. It would be great if JSONEncoder could do that too. Or, maybe I can use another serialization method to implement this behavior?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hello,
I found that if you apply the new .sidebarAdaptable tab view style, the accessibility identifiers of tab bar buttons are missing.
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
Tab("Received", systemImage: "tray.and.arrow.down.fill") {
Text("Received")
}
.accessibilityIdentifier("tab.received") // 👀
Tab("Sent", systemImage: "tray.and.arrow.up.fill") {
Text("Sent")
}
.accessibilityIdentifier("tab.sent") // 👀
Tab("Account", systemImage: "person.crop.circle.fill") {
Text("Account")
}
.accessibilityIdentifier("tab.account") // 👀
}
.tabViewStyle(.sidebarAdaptable) // 👈 if remove this, ax identifiers are ok
}
}
#Preview {
ContentView()
}
The identifiers automatically appear after a few seconds. But this behaviour breaks a lot of the UI test cases.
Hello,
Just noticed an issue with the .safeAreaInset() and .safeAreaPadding() modifiers. On iOS 18 beta 8, I'm unable to scroll the list or any other scrollable views within the safe area. This behavior is different compared to iOS 17/16. For example, adding a floating button using the .safeAreaInset() modifier:
On iOS 18, the list cannot be scrolled or interacted within the bottom circled area.
Hello,
I'm so glad that now you can scroll the list to top by tapping the tab bar ion on iOS 18. However, the current implementation on iOS 18 beta 8 has a little layout issue.
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
Tab("Home", systemImage: "house") {
NavigationStack {
List {
ForEach(0..<100) { i in
Text("\(i)")
}
}
.navigationTitle("Root")
}
}
}
}
}
#Preview {
ContentView()
}
Tap the tab icon:
Result:
Hello,
I noticed a small mistake in the Human Interface Guidelines (HIG).
On the page HIG > Components > System Experiences > Widget > watchOS Widget Dimensions, scroll down to the bottom. In the "watchOS widget dimensions" section, the sizes in the table are in pixels (px), not points (pt) actually. However, the table header indicates the sizes should be in points (pt).
Page link:
https://developer.apple.com/design/human-interface-guidelines/widgets#watchOS-widget-dimensions
For example, the widget size in the Smart Stack on a 49mm watch should be 192x81.5 pt (or 382x163 px), not 382x163 pt. This size can be verified with the information provided here:
https://developer.apple.com/documentation/watchos-apps/supporting-multiple-watch-sizes/.
https://developer.apple.com/documentation/watchkit/wkinterfacedevice/1620974-screenscale
Hello,
I'm using the custom symbol feature in the official SF Symbols app. I'm wondering if there is a way to sync my custom symbols across different devices? Since I have multiple Macs to work on, maybe iCloud?
Hello,
I'm unable to run any test cases in Xcode 16 with the iOS 18 simulator.
Steps to Reproduce:
Create a new iOS project in Xcode 16 using the default iOS app template with the testing option checked.
Run any test or UI test case by clicking the "Play" icon in the Test navigator.
Xcode gets stuck at the "Testing" state indefinitely.
Environment:
macOS 15 beta 8
Xcode 16 beta 6
iOS 18 beta 7 simulator
Hello,
When I turn on tinted mode on iOS 18, I noticed that the emojis in the widgets are not rendered properly. The widget in the following screenshot is the template project created by Xcode 16.
Hello!
The WidgetBundleBuilder always crash on iOS 17 if there is a #available(iOS 18.0, *) check in the WidgetBundle body.
I remember there was a compiler bug (something related to type hoisting) in the past, but that was fixed. This time the bug seems to be in the implementation of the result build itself.
Hello!
I wanted to bring up an issue I've encountered with .popover(isPresented:). It does not show up above a TabView on iOS 18. This issue occurs on an iPad or on an iPhone when using the .popover compact adaptation modifier.
(Xcode 16 beta 6 + iOS 18 beta 7)
Hello, I noticed that the CADisplayLink seems to emit incorrect targetTimestamp and timestamp in the iOS 18 simulator. If you compute the actual duration of a frame, the duration is always a negative number.
This only occurs in the iOS 18 simulator.
Menu > Editor > Canvas > Export Preview Screenshot
Got error message:
Stream with endpoint 'C5C6DCA4-D146-451F-8BA8-AF83657E4CC7' is invalidated
I don't collect diagnostic data.
Xcode 15.3 AppIntentsSSUTraining warning: missing the definition of locale # variables.1.definitions
Hello!
I've noticed that adding localizations for AppShortcuts triggers the following warnings in Xcode 15.3:
warning: missing the definition of zh-Hans # variables.1.definitions
warning: missing the definition of zh-Hans # variables.2.definitions
This occurs with both legacy strings files and String Catalogs.
Example project: https://github.com/gongzhang/AppShortcutsLocalizationWarningExample
⌚️Hello,
I've noticed in watchOS 10 that when a complication is in the Smart Stack, the value of WCSession.isComplicationEnabled is false. I'm not sure if this is intentional or a bug. It seems trivial at first glance, but it actually affects the communication mechanism mentioned in Implementing Two-Way Communication Using Watch Connectivity.
In the following two scenarios, if the user has only added the app's complication to the Smart Stack, then the watch app will not be able to communicate properly with the iOS app.
Scenario 1 - WCSession.transferCurrentComplicationUserInfo()
// update complications from the iOS app
if WCSession.default.isComplicationEnabled {
let userInfoTransfer = WCSession.default.transferCurrentComplicationUserInfo(userInfo)
// ...
}
As described in Implementing Two-Way Communication Using Watch Connectivity, when the iOS app proactively updates the data of the watch app, since WCSession.isComplicationEnabled is false, WCSession will refuse to transfer any data. This causes the standalone complication in Smart Stack to not be updated.
Scenario 2 - WKApplicationRefreshBackgroundTask
When the watch app uses WKApplication.scheduleBackgroundRefresh() to periodically update data, as long as the user has added the app's complication to the watch face, the corresponding WKApplicationRefreshBackgroundTask can be executed periodically in the background to fetch data.
However, if the user has only added complication to the Smart Stack, then the watch app will be completely purged, and the background task will not be executed at all. Although WCSession.isComplicationEnabled is not directly used in this scenario, its behavior appears to be the same, that is, the complication in the Smart Stack is not considered a complication by the system.
Should I submit a bug report?
Hello everyone!
When I run UI Tests on Xcode Cloud, I often encounter unexpected failures. Checking the screen recording, I found that the iOS Simulator could go into a black screen with a white Apple logo and a progress bar for a period after the test starts. This behavior of the Simulator causes my app's UI Tests to fail randomly, which greatly affects the practical use of UI Tests.
I suspect this phenomenon is unrelated to my app and test cases, so I'm asking if anyone else has encountered a similar issue. 🤔