Post

Replies

Boosts

Views

Activity

Connect DSA trader question
Today the Connect page asks me to confirm if I am a trader or not under DSA. I am an independent developer and have several apps in App Store. I have no idea what a trader is. The DSA defines a trader as “any natural person, or any legal person irrespective of whether privately or publicly owned, who is acting, including through any person acting in his or her name or on his or her behalf, for purposes relating to his or her trade, business, craft or profession.” If you have questions about your status as a trader, consult with your legal advisor. I emailed Connect support but their reply is very "official" which confuses me more.
29
8
15k
Apr ’24
self.window.isVisible = NO not working in windowDidLoad
The following code won't work: - (void)windowDidLoad { [super windowDidLoad]; self.window.isVisible = NO; } The only main window still shows on application startup (in a minimal newly created app). One of my published apps in App Store relies on this behavior which had been working for many years since I started Xcode development.
Topic: UI Frameworks SubTopic: AppKit
11
0
159
Apr ’25
Piece of code in Playground that reliably crashes lldb server
Dare anyone try the following code in any Playground: // Define a model that conforms to Codable struct User: Codable { var name: String var age: Int var email: String? } // JSON data (as a string for demonstration) let jsonString = """ { "name": "John Doe", "age": 30, "email": "john@example.com" } """ // Convert the JSON string to Data if let jsonData = jsonString.data(using: .utf8) { do { // Parse the JSON data into the User model let user = try JSONDecoder().decode(User.self, from: jsonData) print("Name: \(user.name), Age: \(user.age), Email: \(user.email ?? "N/A")") } catch { print("Error decoding JSON: \(error)") } } I tested with Xcode 16.2 and latest 16.3, it reliably crashes the lldb server!
6
1
214
Apr ’25
GridView addRow height problem
I am trying to add rows to GridView and not able to get expected row height correctly. override func viewDidLoad() { super.viewDidLoad() // Remove the row in IB designer gridView.removeRow(at: 0) let image = NSImage(named: NSImage.colorPanelName)! //image.size = NSMakeSize(80, 80) let imageView = NSImageView(image: image) imageView.imageFrameStyle = .grayBezel imageView.imageScaling = .scaleAxesIndependently imageView.frame = NSMakeRect(0, 0, 80, 80) let label = NSTextField(labelWithString: "test text") let row = gridView.addRow(with: [imageView, label]) row.height = 80 } What was wrong with my code?
5
0
904
Jan ’24
Reading multi parts of a file concurrently
I have a need to read first half and second half of a file concurrently. Is there any best practices for this scenario? BTW, I did research on DispatchIO but it turned out DispatchIO is all about asynchronous operations on a single file handle; it cannot perform parallel reading. // naive approach Task { fileHandle.read(into:buffer) } Task { // seek to file size / 2 fileHandle.read(into:buffer) }
5
0
1k
Jan ’24
How detect SDK version
I have the following code:@implementation NSWindow (Coordination) - (NSPoint)convertPointFromScreen:(NSPoint)point { NSRect rect = NSMakeRect(point.x, point.y, 1, 1); return [self convertRectFromScreen:rect].origin; }I get a compiliation warning:Category is implementing a method which will also be implemented by its primary classI know Swift has builtin preprocessor directives to detect SDK version, but don't know how to do this in objc. Any suggestions?
6
0
8.1k
Nov ’21
Warning: Reference to captured var 'hashBag' in concurrently-executing code
I get many warnings like this when I build an old project. I asked AI chatbot which gave me several solutions, the recommended one is: var hashBag = [String: Int]() func updateHashBag() async { var tempHashBag = hashBag // make copy await withTaskGroup(of: Void.self) { group in group.addTask { tempHashBag["key1"] = 1 } group.addTask { tempHashBag["key2"] = 2 } } hashBag = tempHashBag // copy back? } My understanding is that in the task group, the concurrency engine ensures synchronized modifications on the temp copy in multiple tasks. I should not worry about this. My question is about performance. What if I want to put a lot of data into the bag? Does the compiler do some kind of magics to optimize low level memory allocations? For example, the temp copy actually is not a real copy, it is a special reference to the original hash bag; it is only grammar glue that I am modifying the copy.
4
0
157
Apr ’25
Need a (simple) algorithm to tell if 2 images differ
I have a need to tell if 2 images are different by unimportant details. For example, one image is only slightly different than another because: *) It is a little stretched *) or it has 99% portion of another (only missing some pixels on borders) I wonder if there is an efficient algorithm to achieve my goal. Any suggestions are welcome.
3
0
2.3k
Mar ’23