MacSysAdmin 2021: Let’s Swift Again!

This is the support document for my online presentation at for MacSysAdmin Online in October 2021.

“New Chooser” icon by Mischa van der Bent, who also helped a lot (as usual) to make the slides look much better.

I am not arguing you should use Swift for everything. I discussed which tool to use for what kind of jobs in my 2019 session “Moving to zsh.”

Update October 2022: With the release of macOS Ventura Apple has removed the deprecated LaunchServices functions. The replacements are now methods of the NSWorkspace object. When you want to use these functions in a way that is compatible older versions of macOS you have to use the LaunchServices functions on Big Sur and older and the NSWorkspace functions on Monterey and higher. I have updated the LSKit.swift file in the gist to use the appropriate functions, depending on the version of macOS the app is running on.

Swift 2: Let’s Swift again!

Swift Progress

Swift Organization Packages

SwiftUI

Command Line Tool

SwiftUI Application

SwiftUI

Building the App

Managed Preferences

Notarized Package Installer

Conclusion

Things you could add:

Command Line Tool

  • extend the command line tool’s help text
  • add an --identifier option to the list and default sub-commands that returns the apps’ identifiers rather than the paths
  • add support for file type handlers

SwiftUI Application

  • Multi-line icon grid, or at least a scrollable icon list
  • multiple schemes (http, mailto, ssh) with tabs
  • proper window size management
  • Exclude apps by identifier (list provided by defaults/config profile)
  • add support for file type handlers
  • add more 🍌

Tutorials