Post

Replies

Boosts

Views

Activity

Reply to Warning: Reference to captured var 'hashBag' in concurrently-executing code
I have found the solution myself. It's actually straightforward, set project min platform to 10.15 and I can do this without warnings anymore: Task { bagLock.lock() hashBag["file"] = hash bagLock.unlock() } Actor is too heavy for this scenario because I have several variables like this in an async function; Mutex is quite new and my project has to target a much older platform like 10.15 which enables me to use Task async.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
More on applicationShouldHandleReopen. it appears that it is called only during debugging. For normal/direct run (double click in Finder) and observe messages in Console, I don't see any: - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)hasVisibleWindows { NSLog(@"%s %d", __func__, hasVisibleWindows); return NO; }
Topic: UI Frameworks SubTopic: AppKit
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
After many hours of digging, it turned out that another possible bug caused this weird problem. It seems AppDelegate applicationShouldHandleReopen is always called no matter if there is an existing running instance. This is true no matter if a project is created using XIB based style or new storyboard style; it's also not related to languages (OBJC or Swift). I verified this on newly created projects. My app has some custom actions to do in applicationShouldHandleReopen that eventually shows the main window. Since now it's called unconditionally, it will show main window on launch. I also verified on my old MBP, applicationShouldHandleReopen is NOT called on app launching during debugging. Is this applicationShouldHandleReopen behavior by design on new macOS versions (13+)?
Topic: UI Frameworks SubTopic: AppKit
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
Mystical event happens when I debug the following code: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [NSOperationQueue.mainQueue addOperationWithBlock:^{ [self.mainWC setup]; }]; } I add a watch self.window.visible and set 2 breakpoints: one at the addOperationWithBlock line and the other inside the block. When the first breakpoint is hit, self.window.visible is NO. But as soon as the second breakpoint is hit, self.window.visible becomes YES. In IB "Visible at Launch" is unchecked for the main window. I have tried clean and rebuild but to no avail. But I cannot reproduce this in a newly created project with similar XIB setup. Does anyone else have such a bizarre situation like mine?
Topic: UI Frameworks SubTopic: AppKit
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
I forgot to mention that my tests are done on the old XIB project because my app was created long ago before storyboard was invented. I tested again on my old MBP with Xcode 14.2 and macOS 12.7.6 (Monterey). Either combination works: Leave "Visible at Launch" checked (default) in IB and self.window.isVisible = NO in awakeFromNib Uncheck "Visible at Launch" in IB and self.window.isVisible = YES in awakeFromNib I believe there are some minor changes at the lower OS level that break this "old" behavior.
Topic: UI Frameworks SubTopic: AppKit
Mar ’25
Reply to Xcode 16.3 DerivedData size problem.
Same issue here. That's ridiculous...
Replies
Boosts
Views
Activity
May ’25
Reply to Swift project build process is extremely slow after upgrading to 16.3
With 16.4RC, GatherProvisioningInputs only takes 0.1 seconds. But VeryModule of the MyFramework still takes more than 16 seconds for a clean/build. BTW, my system is M1 Mac mini.
Replies
Boosts
Views
Activity
May ’25
Reply to Warning: Reference to captured var 'hashBag' in concurrently-executing code
I have found the solution myself. It's actually straightforward, set project min platform to 10.15 and I can do this without warnings anymore: Task { bagLock.lock() hashBag["file"] = hash bagLock.unlock() } Actor is too heavy for this scenario because I have several variables like this in an async function; Mutex is quite new and my project has to target a much older platform like 10.15 which enables me to use Task async.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to Xcode Documentation window eats up much CPU time
Surprisingly, after disabling hotspot indexing, the world becomes peaceful and calm. Now whenever I click a link in the quick help pane, the docs navigation pane immediately locates the context where the link is about. It had been non-functioning for the past several versions!
Replies
Boosts
Views
Activity
Apr ’25
Reply to Xcode 16.3 Beta3: Developer Documentation Indexing does not end...resulting in Xcode CPU Usage high over long time.
Same problem here. Please fix it ASAP, maybe via a hotfix.
Replies
Boosts
Views
Activity
Apr ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
The problem is that older Xcode versions did not call this method when I start debugging. Of course, after app finishes launching, when I click app icon in doc, the app will receive this callback.
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Apr ’25
Reply to App upload warnings (never seen before)
The project links against one framework and library that was built from my own projects. Now I believe I need to rebuild them using current version of Xcode.
Replies
Boosts
Views
Activity
Apr ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
I filed a bug report here.
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Apr ’25
Reply to Piece of code in Playground that reliably crashes lldb server
Here is the bug ticket.
Replies
Boosts
Views
Activity
Apr ’25
Reply to Piece of code in Playground that reliably crashes lldb server
BTW, it works perfectly in the old Xcode 14.2 version.
Replies
Boosts
Views
Activity
Apr ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
More on applicationShouldHandleReopen. it appears that it is called only during debugging. For normal/direct run (double click in Finder) and observe messages in Console, I don't see any: - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)hasVisibleWindows { NSLog(@"%s %d", __func__, hasVisibleWindows); return NO; }
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
After many hours of digging, it turned out that another possible bug caused this weird problem. It seems AppDelegate applicationShouldHandleReopen is always called no matter if there is an existing running instance. This is true no matter if a project is created using XIB based style or new storyboard style; it's also not related to languages (OBJC or Swift). I verified this on newly created projects. My app has some custom actions to do in applicationShouldHandleReopen that eventually shows the main window. Since now it's called unconditionally, it will show main window on launch. I also verified on my old MBP, applicationShouldHandleReopen is NOT called on app launching during debugging. Is this applicationShouldHandleReopen behavior by design on new macOS versions (13+)?
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
Mystical event happens when I debug the following code: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [NSOperationQueue.mainQueue addOperationWithBlock:^{ [self.mainWC setup]; }]; } I add a watch self.window.visible and set 2 breakpoints: one at the addOperationWithBlock line and the other inside the block. When the first breakpoint is hit, self.window.visible is NO. But as soon as the second breakpoint is hit, self.window.visible becomes YES. In IB "Visible at Launch" is unchecked for the main window. I have tried clean and rebuild but to no avail. But I cannot reproduce this in a newly created project with similar XIB setup. Does anyone else have such a bizarre situation like mine?
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
Actually when it comes to the real world, things become even weird. In the App Store app project, I unchecked "Visible at Launch" but when I debug/run the app, the main window still shows. It's even true after I comment out awakeFromNib in which I do lots of initialization work.
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25
Reply to self.window.isVisible = NO not working in windowDidLoad
I forgot to mention that my tests are done on the old XIB project because my app was created long ago before storyboard was invented. I tested again on my old MBP with Xcode 14.2 and macOS 12.7.6 (Monterey). Either combination works: Leave "Visible at Launch" checked (default) in IB and self.window.isVisible = NO in awakeFromNib Uncheck "Visible at Launch" in IB and self.window.isVisible = YES in awakeFromNib I believe there are some minor changes at the lower OS level that break this "old" behavior.
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25