Post

Replies

Boosts

Views

Activity

Reply to A question about Swift enum syntax
Does this mean using a dot before an enum case name is just for show? Not quite. This compiles because allCases is declared in the same scope as the cases, so it knows what third is by simple name resolution. You could even declare allCases like this: static let allCases = [first, second, third] But if you were to use the cases outside the enum body, then the dot is needed to make them into implicit member expressions with type inference: let allStuffCases: [Stuff] = [.first, .second, .third] Or here’s another way to let type inference do its thing: let allStuffCases = [Stuff.first, .second, .third]
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’23
Reply to Non-breaking space Xcode 15 XCStrings
Just embed the desired character directly in your localized string, the same as any emoji or other non-ASCII character. Consider: if the xcstrings format required using source code style escape sequences for non-ASCII characters, it wouldn’t be very friendly to anyone making localizations for most non-English languages in the world. So it just accepts all characters directly. Note the underlying format is JSON encoded in UTF-8, so it can store all possible characters.
Sep ’23
Reply to Long Term Support
Note that “deprecated” is not the same as “removed” — things marked deprecated generally continue to work fine in later releases. There are a few outliers that have changed more abruptly (e.g. fetching the device name or telephony information) but those tend to be privacy improvements and probably wouldn’t be grandfathered in an LTS arrangement anyway. Also note that users don’t expect apps to have “long term versions” that never get updated; active apps get new features or just bug fixes at least a few times per year and often every week or so. I personally won’t download any app that doesn’t appear to be in active ongoing development, judging by the release history.
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’23
Reply to traitCollectionDidChange deprecated in Xcode 15
Look closely at the code example under Discussion in the documentation for registerForTraitChanges(_:handler:). Note that you need to specify the UITrait type(s) that represent the trait(s) you are interested in, which would be expressed like this: let traits = [UITraitUserInterfaceStyle.self]
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’23
Reply to How to identify when a SIM is changed in iPhone
There is no API to discover the user’s phone number. That would be a massive privacy fail. (There used to be a non-deprecated way to get notified when the SIM is changed, but it still didn’t tell you the actual number. And it’s deprecated now anyway.) If @eskimo's suggestion in your other thread doesn’t satisfy your requirements, then I’d suggest you re-examine the requirements. Why are you trying to make the security of the app depend on hardware rather than than just user credentials? What is the threat you are trying to address? Just sayin’... I have lots of financial apps on my own phone from well-known institutions (banks, brokerages, etc.) and they all use the normal security features: username/password, Face ID, 2FA, etc. I’m curious why your app has requirements that go beyond this.
Topic: App & System Services SubTopic: Hardware Tags:
Oct ’23
Reply to Xcode 15 | iOS 17 | Dateformatter issue with short style
Please help me understand why this change needed to happen. Because a hippie dropout named Steve Jobs audited a calligraphy class at Reed College in 1972. Seriously... sort of. That’s often cited as the genesis of Apple’s exacting quality of typography over the years. In this case, I’d argue that using a no-break space is a nice little improvement, so that (for example) 9:41 AM won’t get split across two lines if it falls at the end of a line in a formatted paragraph. Otherwise with a normal space, this could get split at a line break, which looks a little odd.
Topic: App & System Services SubTopic: General Tags:
Oct ’23
Reply to JSONEncoder ASCII encoding issue
I can confirm your finding on iOS 17 and macOS Sonoma: JSONEncoder’s encoding of strings now stops at the first zero byte. It appears to be this bug which was introduced in the Swift rewrite of JSON encoding: JSONEncoder: Fixed escaping of certain strings. Since there’s no good workaround, is it feasible to change your blob encoding? Your current encoding scheme is pretty unusual. If you directly encode your image to JSON as a Data object, it uses base64 and just works.
Topic: App & System Services SubTopic: General Tags:
Oct ’23
Reply to Dark blue heart emoji
You’ll probably get a gentle invitation to re-post this question in the user support forum, but on top of that: note the available emoji are defined in the Unicode standard which Apple simply uses. The Unicode Consortium presumably has some process for submitting feedback like this.
Topic: Design SubTopic: General Tags:
Oct ’23
Reply to Symbol navigator is polluted with thousands of system classes!
Try the Show only project-defined symbols button in the filter bar at the bottom of the symbol navigator. Or are you reporting that it’s not working? (Also note the symbol navigator was removed in Xcode 15.)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to A question about Swift enum syntax
Does this mean using a dot before an enum case name is just for show? Not quite. This compiles because allCases is declared in the same scope as the cases, so it knows what third is by simple name resolution. You could even declare allCases like this: static let allCases = [first, second, third] But if you were to use the cases outside the enum body, then the dot is needed to make them into implicit member expressions with type inference: let allStuffCases: [Stuff] = [.first, .second, .third] Or here’s another way to let type inference do its thing: let allStuffCases = [Stuff.first, .second, .third]
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to Non-breaking space Xcode 15 XCStrings
Just embed the desired character directly in your localized string, the same as any emoji or other non-ASCII character. Consider: if the xcstrings format required using source code style escape sequences for non-ASCII characters, it wouldn’t be very friendly to anyone making localizations for most non-English languages in the world. So it just accepts all characters directly. Note the underlying format is JSON encoded in UTF-8, so it can store all possible characters.
Replies
Boosts
Views
Activity
Sep ’23
Reply to Long Term Support
Note that “deprecated” is not the same as “removed” — things marked deprecated generally continue to work fine in later releases. There are a few outliers that have changed more abruptly (e.g. fetching the device name or telephony information) but those tend to be privacy improvements and probably wouldn’t be grandfathered in an LTS arrangement anyway. Also note that users don’t expect apps to have “long term versions” that never get updated; active apps get new features or just bug fixes at least a few times per year and often every week or so. I personally won’t download any app that doesn’t appear to be in active ongoing development, judging by the release history.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to traitCollectionDidChange deprecated in Xcode 15
Look closely at the code example under Discussion in the documentation for registerForTraitChanges(_:handler:). Note that you need to specify the UITrait type(s) that represent the trait(s) you are interested in, which would be expressed like this: let traits = [UITraitUserInterfaceStyle.self]
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to How to identify when a SIM is changed in iPhone
There is no API to discover the user’s phone number. That would be a massive privacy fail. (There used to be a non-deprecated way to get notified when the SIM is changed, but it still didn’t tell you the actual number. And it’s deprecated now anyway.) If @eskimo's suggestion in your other thread doesn’t satisfy your requirements, then I’d suggest you re-examine the requirements. Why are you trying to make the security of the app depend on hardware rather than than just user credentials? What is the threat you are trying to address? Just sayin’... I have lots of financial apps on my own phone from well-known institutions (banks, brokerages, etc.) and they all use the normal security features: username/password, Face ID, 2FA, etc. I’m curious why your app has requirements that go beyond this.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Xcode 15 | iOS 17 | Dateformatter issue with short style
Please help me understand why this change needed to happen. Because a hippie dropout named Steve Jobs audited a calligraphy class at Reed College in 1972. Seriously... sort of. That’s often cited as the genesis of Apple’s exacting quality of typography over the years. In this case, I’d argue that using a no-break space is a nice little improvement, so that (for example) 9:41 AM won’t get split across two lines if it falls at the end of a line in a formatted paragraph. Otherwise with a normal space, this could get split at a line break, which looks a little odd.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to JSONEncoder ASCII encoding issue
I can confirm your finding on iOS 17 and macOS Sonoma: JSONEncoder’s encoding of strings now stops at the first zero byte. It appears to be this bug which was introduced in the Swift rewrite of JSON encoding: JSONEncoder: Fixed escaping of certain strings. Since there’s no good workaround, is it feasible to change your blob encoding? Your current encoding scheme is pretty unusual. If you directly encode your image to JSON as a Data object, it uses base64 and just works.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to iOS Simulator Version 17.0.3 in Xcode
See this thread for discussion of why you shouldn’t expect to find it. Why do you believe your project requires that exact version?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to background excution lifecycle
try to avoid relying on the exact order of events @eskimo This could go with the topic of relying on undefined behavior that I proposed here.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to How to install an Xcode version compatible with macOS 14.6?
Is this the Xcode version I should install to work with macOS Ventura 14.6? Yes. What is the extension ".xip"? (See #3 in image above.) It’s a self extracting archive. After downloading, just double-click on the file and go grab a coffee.
Replies
Boosts
Views
Activity
Oct ’23
Reply to Why is the image captured by `SCScreenshotManager.captureImage` so blurry?
Note that SCDisplay’s width and height properties are specified in points, while SCStreamConfiguration may expect width and height to be specified in pixels.
Replies
Boosts
Views
Activity
Oct ’23
Reply to Xcode 15 crashes when editing info.plist or other project information
Looks like you encountered this known and reported bug.
Replies
Boosts
Views
Activity
Oct ’23
Reply to Dark blue heart emoji
You’ll probably get a gentle invitation to re-post this question in the user support forum, but on top of that: note the available emoji are defined in the Unicode standard which Apple simply uses. The Unicode Consortium presumably has some process for submitting feedback like this.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to new time format style in ios 17
Just use the normal DateFormatter and you should get the new style in iOS 17. See this thread for more discussion.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23