Post

Replies

Boosts

Views

Activity

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 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 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 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 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 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 Extension method for Optional of String
The code in that article is still correct. It’s this line in the test which is going wrong: print(s?.isBlank) This unwraps the optional s and then calls isBlank only if s was non-nil. If s was nil then the result of the entire expression is nil. Note this isBlank method is defined in an extension on String, which is given in the article but not shown here. To test this correctly, the line should be this: print(s.isBlank) This calls the isBlank method which is defined in the extension on Optional<String>. It’s totally separate from the other isBlank.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’23
Reply to Xcode 15 RC bug with interpreting objective-c literal @-1.
Well that’s weird. Your test case is working correctly for me here in Xcode 15.0 (15A240d) on a Mac with M1 Max. Does the behavior change if you format the literal as @(-1) with parentheses? Can you format the key via some code (like a number formatter) to confirm the issue is really the compiler, vs just an issue in the debugger? That value 18446744073709551615 happens to be 2^64-1, the same bit pattern as -1 in a 64-bit signed integer. Maybe that’s a clue.
Sep ’23