SwiftUI provides us with a lot of functionality and, as a rule, it provides most of what we need. However, there are some things it does not give us access to and, when we need to venture into this territory, it can be useful to be able to access the underlying NSWindow in which our view is running. SwiftUI does not give us a way to do that.
Not a Blog
A place to save useful development notes.
One of the problems with developing something new for a new platform is knowing just what to do. As a long time Windows developer, I know what I want to achieve, but don't know how to achieve it. It's very frustrating.
I started out fixing this with a Mac app template project, which proved very instructional but didn't really reflect a real world application. So I created a second in Mac application, based on a more realistic app. Doing this gave more insight into what it was that I didn't know.
My first app is now at a stage where I have built a working application with the majority of the functionality it needs to operate. Along the way, I had many challenges to overcome. Some relatively simple and some rather complex. This section is intended to document some of these challenges and the solutions I came up with.
Along the way, I may well come up with other stuff that I need to document be it Macos, iOS or anything else. I'll add those in as and when.
When your view contains data that has to be manually saved (to a file for example), it is critical to know if your app is terminated or the window is closed. I found that out the hard way by making multiple edits to a file and promptly losing them all when I closed the window without saving!
Testimonials
Am I really any good?
Don't take my word for my abilities, take a look at other peoples opinions about me.