Post

Replies

Boosts

Views

Activity

Reply to Find selected text
I would like to be able to select the text I’m looking for, then use a shortcut that would immediately search for the selected text in the current editor. If you can get by on two shortcuts: ⌘ E (menu command Find → Use Selection for Find), then ⌘ G (menu command Find → Find Next)
Mar ’25
Reply to NSString initWithFormat crash on ios18
If you post more info about your high-level goal here, I should be able to offer more insight into how to proceed. That format string is actually URL-encoded JSON: {"sign":null,"company":"兄弟海洋科技有限公司","businessNo":null,"scene":null,"interviewCode":"767676"} Even without the URL encoding, there are no %@ placeholders that the string initializer expects. So if the high-level goal is to generate this JSON with certain parameters inserted at run time, and then URL-encode it, there are far better techniques for doing so.
Topic: App & System Services SubTopic: General Tags:
Mar ’25
Reply to Capturing self instead of using self. in switch case in DispatchQueue causes compiler error
Definitely a bug, since your code actually crashes the Swift REPL: Welcome to Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1). Type :help for assistance. 1> import Foundation 2. class Claude { 3. var fieldBeingEdited = 0 4. let kTag = 0 5. 6. @objc func keyboardDone(_ sender : NSObject) { 7. DispatchQueue.main.async { [self] () -> Void in 8. switch fieldBeingEdited { 9. case kTag : break 10. default : break 11. } 12. } 13. } 14. } LLDB diagnostics will be written to /var/folders/z3/53rv5j6x0697yjhjh890hnnr0000gr/T/diagnostics-18fbd0 Please include the directory content when filing a bug report PLEASE submit a bug report to https://developer.apple.com/bug-reporting/ and include the crash backtrace. [ ... stack trace omitted ... ] If I remove the case kTag line, then it has no error.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’25
Reply to UITabbarController issue on iOS 18
So I just want to get confirmation from Apple if this will be a new update for UI events or just an issue that will be fix in upcoming iOS versions. I don’t see this mentioned in any iOS 18.* release notes. So there are a few possibilities: It’s a newly introduced bug. Consider submitting a bug report via Feedback Assistant. (And post the bug number here, just for the record.) It’s a fix of a previous bug, but they forgot to mention it in the release notes. Consider submitting a Feedback on this. It’s merely a change from old valid behavior to new valid behavior, with no release notes required. I vote for the 3rd interpretation. Unless the UIKit documentation already covers the relative ordering of these calls (thus establishing an API contract in this area) then either order is plausible. Is the view going to disappear? Yes. Did a new tab get selected? Yes.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’25
Reply to Returning One Component of Struct as Encoded Value in JSON
You are close. The custom encode(to:) just needs to be the inverse operation of init(from:) (using a single value container) like this: func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() try c.encode(asString) } Should I do JSONSerialization instead? Nope! That’s a huge step backwards from the nice Swift Codable API. BTW, would it be feasible to make asDouble be a computed property, derived from asString as needed? Or the other way around? Ideally only one of them would be a stored property to serve as the single source of truth.
Jan ’25
Reply to Is there a way of specifying unicode characters for the BUNDLE_DISPLAY_NAME in an .xcconfig?
Just enter the desired character directly in the xcconfig file. The XML character reference ߒ isn’t needed since an xcconfig file isn’t XML. It’s just a text file encoded in UTF-8 so just about any character should work. Also note that you can enter this directly in the Info.plist file too. The XML character reference syntax is fine of course (and improves readability in this case) but isn’t needed in most cases.
Jan ’25
Reply to Tracking eSIM data usage
Even worse, interface names such as pdp_ip0 and en0 are not considered API, so you really shouldn’t rely on them at all. (Search the forum for those names for more about this.) And even if each SIM got its own documented BSD interface, the deprecation of CTCarrier means it would be hard to even figure out a name for the SIM currently being used. #include <ususl_caveat_about_specially_entitled_carrier_apps>
Jan ’25
Reply to is forKey:fileSize considered accessing non-public API?
is forKey:fileSize considered accessing non-public API? value(forKey:) itself is public API of course, so you likely wouldn’t get rejected by whatever means App Review uses to try to flag more obvious non-public API usage. However, you are relying on undefined behavior, which is still a bad idea for compatibility. The documentation of that class doesn’t mention a property by that name being supported via KVC. In fact, at this very moment, an engineer at Apple may be busy rewriting PHAssetResource in a way that still conforms to the documented API but no longer responds to fetching that particular property via KVC, and your code would stop working in the next OS release. Make sure your app can handle that.
Jan ’25