Post

Replies

Boosts

Views

Activity

Reply to macOS Zoom Button
As an application can have multiple windows, the function below will hide the zoom button on all windows, however you can filter out a specific window that you want to target if you choose. func hideZoomButton() {     for window in NSApplication.shared.windows {         if let zoomButton = window.standardWindowButton(NSWindow.ButtonType.zoomButton) {             zoomButton.isHidden = true         }     } } You can then call this function from you application delegate on applicationDidFinishLaunching
Jan ’22
Reply to What is the next step in coding?
I find that except for learning the syntax of a language, there's no real point in going over tutorials unless you're actually going to use the knowledge from the tutorial for a project you're working on. Also don't waste money, because most things are freely available on the internet. Pick a project that appeals to you and work on it. That's the best way to learn. Don't get caught in the tutorial trap, because unless you're actually using it for something practical, everything from the tutorial will be forgotten after a while. Continuously building applications is the best way to learn and retain knowledge. It also doesn't matter if what you're building already exists. The point is that you want to learn from the experience of building something. You will hit roadblocks along the way and when you do, then you look up how to solve the problem you've encountered. This is way more efficient than pointlessly going over tutorials. Considering you're in school, you probably want an app to help you study. Perhaps you could build an app that lets all of your friends add multiple choice questions to a database for various subjects. You can then take a quiz where you get x number of random questions and you show your test scores on a leader board. Not only does this help you study, but it gamifies studying to keep you motivated. You can store the questions using CloudKit.
Apr ’22
Reply to SwiftUI, Table and the multiple row selection problem (macos).
Manually generating the NSManagedObject and removing the optional can cause more issues. I did this and when trying to delete from the table, I hit an exception, because it's trying to access a nil id property, even though I've removed it from the context. My solution was to name the attribute itemId and then create an extension on Item and create a read-only id: UUID property. extension Item { public var id: UUID { itemId ?? UUID() // unfortunately I needed to provide a default here, which seems like a hacky solution. } } At least in this way you don't have to bother with manually generating the subclasses either.
Dec ’22
Reply to WARNING: Application performed a reentrant operation in its NSTableView delegate. This warning will become an assert in the future.
I've managed to get this warning once in my own SwiftUI macOS application when adding a single record to core data. However, I wasn't able to replicate it again, which makes it very difficult to debug and find the exact cause. Based on the warning "reentrant operation", I'm guessing it's related to concurrency and possibly a background thread trying to update the UI or some sort of race condition. If you can replicate this consistently, perhaps do a test by running the core data operation on the main actor, then we'll know for certain what's the cause.
Dec ’22