Post

Replies

Boosts

Views

Activity

Comment on Difference between private and fileprivate?
The info in the language reference does not explain what's the difference. It seems when used in file level private is same as fileprivate: class SandBoxVC: NSViewController { override func viewDidLoad() { super.viewDidLoad() print(aaaa, bbbb) // no compiler error here } } fileprivate let aaaa = 1234 private let bbbb = "bbbb" I almost believe this is an oversight bug in Swift compiler - private should not be used in file level.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’24
Comment on How display shortened path in a label?
Ah, I didn't notice there is this builtin property!
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Dec ’23
Comment on Unable to delete .com.apple.containermanagerd.metadata.plist file inside /Library/Containers/{YourApplicationFolder}.
Same problem here, macOS Sonoma 14.2.1.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Comment on Can't get Xcode to parse the code in one file in editor
You don't need to start over again. What I meant was remove the file by reference from the project and add it back again. This should work.
Replies
Boosts
Views
Activity
Jan ’24
Comment on File name globbing in Swift
I am aware of Regex, but it's not the same as direct file pattern globbing. And for my case, I need to support older macOS versions (11+), but Regex is only available on macOS 13+.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’24
Comment on NSMutableDictionary removeAllObjects does not free up used memory!
Ah, yes. This is the second time I fell into the same pit. The last time was years ago... Just hate this design by Apple, why a tight loop cannot have ARC automatically?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’24
Comment on What's the unit in NSView coordinate system
That's the missing little piece...
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’24
Comment on Connect DSA trader question
Ah, English is not my native language. And any legal documentation is cryptic to me, I can never understand them, even if they are written in my native language.
Replies
Boosts
Views
Activity
Mar ’24
Comment on Where can I found a list of codes for NSEvent.keyCode
I don't believe it's a bug. It's simply that I didn't know where to find the predefined key codes. import Carbon.HIToolbox does the job.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’24
Comment on How tell if NSTableView is already displaying its last row entirely?
I am on Appkit, it seems NSScrollView does not have onChange event, and I cannot find any properties/notifications that can tell me the current scroll position. That's odd.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’24
Comment on How keep NSWindow always on top other windows?
I tend to use your answer after reading docs because NSPanel offers more features that are just what I need for a "preview" window.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’24
Comment on Cannot get NSTimer working in another thread
I also found out this soon after I posted my question: [NSRunLoop.currentRunLoop run];
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’24
Comment on How know if windowWillClose: is invoked by X button click
That SO thread is about a custom X button. I want to know if there is any way to hook up the action of the system X button.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
May ’24
Comment on Difference between private and fileprivate?
The info in the language reference does not explain what's the difference. It seems when used in file level private is same as fileprivate: class SandBoxVC: NSViewController { override func viewDidLoad() { super.viewDidLoad() print(aaaa, bbbb) // no compiler error here } } fileprivate let aaaa = 1234 private let bbbb = "bbbb" I almost believe this is an oversight bug in Swift compiler - private should not be used in file level.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Comment on Difference between private and fileprivate?
I cannot access private or fileprivate vars in another file right? So what's the difference?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Comment on Difference between private and fileprivate?
Yes, this is just what I want. I wanted the experts to confirm that private and fileprivate at file level work the same way. BTW, I am quite familiar with private modifier inside enum/class/struct definitions.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24