Post

Replies

Boosts

Views

Activity

Reply to NSuserdefault issue after restart my iphone
@mutou519 have you checked that you saved to userDefaults ? May be, when you quit the app (by swiping up ?), you don't go through the code that saves userDefaults. To check: in the part of code where you intent to save, add a print statement to check in logs that it was effectively done. If that's the case, you should save userDefaults in SceneDelegate: func sceneDidEnterBackground(_ scene: UIScene) { // Save userDefaults } and also possibly here: func sceneDidDisconnect(_ scene: UIScene) { } and read here: func sceneWillEnterForeground(_ scene: UIScene) { // read userDefaults } You could also save in AppDelegate: func applicationWillTerminate(_ application: UIApplication) { // Save userDefaults }
Topic: App & System Services SubTopic: General Tags:
Jun ’25
Reply to Xcode 26 Beta1 UISegmentedControl can't change value
I tested (with segmented control in storyboard) and noticed several issues: if behaviour for both segments is "Enabled" and "non selected" I cannot switch from First to second the title disappears, hidden by a white mask if first segment selected (in storyboard) when selected second, its title is hidden I can slide a first time and everything displays OK I can swipe back to first But title of first is hidden as well If I select first by clicking, cannot swipe anymore… Note: this issue of title hidden when item selected occurs also with tabbar buttons.
Topic: UI Frameworks SubTopic: UIKit
Jun ’25
Reply to Any apple employees here?
This is "just" a place for developers to help other developers. It is not an official channel to Apple, even though some Apple experts contribute with high value, on an individual basis. Some use the forum to report issues, but that should be done through Feedback assistant: https://feedbackassistant.apple.com To get contact with Apple representative, use the Contact Us link : https://developer.apple.com/contact/topic/select
Jun ’25
Reply to JSONDecoder enum-keyed dictionary bug
They explain here a subtle behaviour (to say the least) of JSONEncoder. https://forums.swift.org/t/encoding-decoding-a-swift-dictionary-to-from-json/39989 A dictionary with Int or String key is encoded as dictionary. But with other type key, it is encoded as an array. That seems to be the case with the enum. I tested by catching error: do { let json = try JSONDecoder().decode(Json.self, from: jsonString.data(using: .utf8)!) print("JSON", json) } catch { print("Error", error) } and got the same error message: Error typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "variations", intValue: nil)], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil)) As you noted, if you replace the key type by String: struct Json: Codable { let variations: [String: String] } Then you get the expected result: JSON Json(variations: ["plural": "tests", "singular": "test"])
Topic: App & System Services SubTopic: General Tags:
Jun ’25
Reply to How to modify the title of a post in the Developer Forums?
You can modify only in the first hour after posting. After, the post cannot be edited. In your case, you could: create a new post with the new title and maybe modified content.It would also be fine to point to the old post. in the old post, make a new answer where you link to the new post, explaining it is more general. IMHO, it is not worth bothering moderator for such a change.
Jun ’25
Reply to Window number too large
Where did you get that windowNumber is UInt32 ? Doc states: var windowNumber: Int { get } On 32-bit platforms, Int is the same size as Int32, and on 64-bit platforms, Int is the same size as Int64. But never a UInt32. Why do you need converting from Int to UInt32 ?
Topic: UI Frameworks SubTopic: General Tags:
Jun ’25
Reply to NSuserdefault issue after restart my iphone
@mutou519 have you checked that you saved to userDefaults ? May be, when you quit the app (by swiping up ?), you don't go through the code that saves userDefaults. To check: in the part of code where you intent to save, add a print statement to check in logs that it was effectively done. If that's the case, you should save userDefaults in SceneDelegate: func sceneDidEnterBackground(_ scene: UIScene) { // Save userDefaults } and also possibly here: func sceneDidDisconnect(_ scene: UIScene) { } and read here: func sceneWillEnterForeground(_ scene: UIScene) { // read userDefaults } You could also save in AppDelegate: func applicationWillTerminate(_ application: UIApplication) { // Save userDefaults }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to Xcode 26 Beta1 UISegmentedControl can't change value
I tested (with segmented control in storyboard) and noticed several issues: if behaviour for both segments is "Enabled" and "non selected" I cannot switch from First to second the title disappears, hidden by a white mask if first segment selected (in storyboard) when selected second, its title is hidden I can slide a first time and everything displays OK I can swipe back to first But title of first is hidden as well If I select first by clicking, cannot swipe anymore… Note: this issue of title hidden when item selected occurs also with tabbar buttons.
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jun ’25
Reply to Any apple employees here?
This is "just" a place for developers to help other developers. It is not an official channel to Apple, even though some Apple experts contribute with high value, on an individual basis. Some use the forum to report issues, but that should be done through Feedback assistant: https://feedbackassistant.apple.com To get contact with Apple representative, use the Contact Us link : https://developer.apple.com/contact/topic/select
Replies
Boosts
Views
Activity
Jun ’25
Reply to JSONDecoder enum-keyed dictionary bug
They explain here a subtle behaviour (to say the least) of JSONEncoder. https://forums.swift.org/t/encoding-decoding-a-swift-dictionary-to-from-json/39989 A dictionary with Int or String key is encoded as dictionary. But with other type key, it is encoded as an array. That seems to be the case with the enum. I tested by catching error: do { let json = try JSONDecoder().decode(Json.self, from: jsonString.data(using: .utf8)!) print("JSON", json) } catch { print("Error", error) } and got the same error message: Error typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "variations", intValue: nil)], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil)) As you noted, if you replace the key type by String: struct Json: Codable { let variations: [String: String] } Then you get the expected result: JSON Json(variations: ["plural": "tests", "singular": "test"])
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to How to modify the title of a post in the Developer Forums?
You can modify only in the first hour after posting. After, the post cannot be edited. In your case, you could: create a new post with the new title and maybe modified content.It would also be fine to point to the old post. in the old post, make a new answer where you link to the new post, explaining it is more general. IMHO, it is not worth bothering moderator for such a change.
Replies
Boosts
Views
Activity
Jun ’25
Reply to Window number too large
Where did you get that windowNumber is UInt32 ? Doc states: var windowNumber: Int { get } On 32-bit platforms, Int is the same size as Int32, and on 64-bit platforms, Int is the same size as Int64. But never a UInt32. Why do you need converting from Int to UInt32 ?
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’25