So, I made a new app. Sort of. It's called DefaultApp, and here it is...
Very minimalist, right? Here's a screenshot of the Preferences and About windows...
And that's the whole app. It's not something you can actually use or do anything with. Instead, it's an app you can build something new with.
DefaultApp is an open source starting point - a template. I maintained it in Objective-C for over a decade before finally porting it to Swift in 2018. Anytime I start a new app - big or small, whether or not it's something I plan on releasing publicly or if it's just a small prototype or utility app I'm building for myself - I start with this project.
I very much build software in fits and spurts while running off the adrenaline of a new idea. And if I just want to quickly try out an idea, the time from
Xcode → New Project to getting all my usual settings and dependencies in place to where I can actually start working on whatever I have in mind is thirty minutes full of friction, busy work, and me cursing myself every time I screw up some dumb little configuration detail. And when my brain is running at a thousand miles per hour thinking about the possibilities of what I want to build, that half hour of just getting to the point where I can get started is excruciating and a motivation killer.
But with DefaultApp I can go from initial idea to writing actual code in thirty seconds.
Every major web framework has a project like this already. This is nothing new. DefaultApp is basically a glorified "Hello World" project but with my own highly-opinionated choices and foundational level code snippets included to help get things moving quickly.
- It builds a native macOS app targeting 10.14 Mojave and 10.15 Catalina.
- A hardened-runtime target ready for Notarization and designed to be distributed directly to your customers.
- A second, duplicate target that is Sandboxed and ready for distribution via the Mac App Store.
- Conditional build flags that let you differentiate between debug and production builds as well as Mac App Store and direct to consumer builds.
- It also builds an iOS companion app target for iOS 13 with shared code between the two platforms.
NSWindowControllers for a primary app window and Preferences window are wired up and ready to go. They're also built using
xibs because storyboards on macOS are dumb.
- The app is
AppleScriptenabled by default and includes a sample
.sdefscripting dictionary because you can pry
AppleScriptsupport out of my cold, dead hands.
- Two helper classes that make building a typical macOS source list easy.
- A few common controls and
NSViewsubclasses that I find myself using in nearly every project.
- Sane Xcode defaults for settings such as enabling insecure HTTP requests in web views but not in the rest of the app and also making the project compatible with
agvtool. Little things such as those that are helpful but nearly impossible to google unless you know what you don't know.
- Pre-configured to check for app updates with Sparkle. (And in the Mac App Store target, Sparkle is completely removed to appease the App Review gods.)
- A fair amount of other miscellaneous code and helper
extensions that always come up and no one wants to write from scratch each time.
Cartfiles that include the usual open source libraries I include in all of my projects. (I would have migrated to the Swift Package Manager instead, but not everything is available through it yet.)
As I said above, the default settings and choices made in this project are my own highly opinionated way of doing things. And I'm well aware I approach things differently than other developers. As a solo dev running my own company, my highest priorities are being pragmatic and efficient. So I make use of tools that allow me to move the fastest regardless of whether or not they're in vogue. I lean on open source projects that are reliable and cost effective for a small (no, tiny) software business.
My most popular GitHub repo is the Simple PHP Framework. It contains code dating back to 2005 that was organically gathered and grouped together into a foundation that I still use to this day to build all of my websites with. Would I use it to build a giant online storefront or a complex backend API? Maybe? It's certainly been used in those situations before. But it's really aimed at single developers or small teams who want to get shit done fast and with minimal fuss.
I view DefaultApp as my equivalent project for macOS development. While it certainly works for me and serves as the basis for all of my apps, I don't know yet if it will work well for others the way my PHP framework has over the years. I guess what I'm saying is don't use this as the basis for a billion dollar corporation's enterprise app. Or with a team of "100 engineers" "solving hard problems".
But if you're a one-person development shop or a team of just two or three engineers building a typical macOS shoebox or document based app? Please take a look. Or, if you're just getting your feet wet in Mac development and want to see how someone who's had moderate success† on the platform structures a new project, you might find it helpful - particularly the three classes related to implementing an
(†Sorry, that line just sounds so arrogant when I read it, but I'm not sure how else to put it. I've been writing Mac apps for seventeen years now, and despite my many (probably) unorthodox development practices, I ship consistently and earn a decent income. My 21 year-old self would never have believed I'd even reach the point I'm at now. Before I finally found the Hillegass book on a bottom shelf in Barnes & Noble in 2004, 2003 Tyler would have killed for an example project like this. Native Mac apps feel like a dying breed that are succumbing to janky web views and (mostly) awful Catalyst ports. If DefaultApp can help just one developer new to the platform get started, then I'll be ecstatic.)
Anyway, this is the first release of DefaultApp. I've got more old projects I've yet to comb through for other useful snippets to include, but this is nonetheless a good starting point for when you're building a simple to moderately complex Mac app or just want to create a quick prototype.