Some Swift Updates

Earlier this year, at JNUC I did a presentation on how to “Use Swift with the Jamf API” and one of the things promised there is a series of articles that described more details than I could cover in the 30 minute presentation.

Note: the session video (and all other JUNC sessions recordings) is available to attendees of JNUC in the conference portal for 60 days. Then the sessions will be made available on YouTube for everyone.

The first part has been out for a while. But for various reasons, the second part took much longer than anticipated. Nevertheless, the wait is over and you can go read the second part here!

Future installments will hopefully not take as long.

If you worked your way through the first part, the Jamf Blog CMS had initially mangled some of the Swift code which lead to some errors. Those errors are now fixed. The sample code repo always had the correct code.

Much earlier (last year) I did a different presentation on Swift at MacSysAdmin. Some of the code used in that presentation’s demo to change the default browser was already deprecated. I still used the deprecated LaunchServices functions because the replacement functions were only made available in Monterey and I wanted the code to work on older versions of macOS, as well. Now, in Ventura, the deprecated functions have been removed. I have updated the sample code to now check the macOS version and use the older LaunchServices functionality on Big Sur and older, and the new NSWorkspace based functions in Monterey and higher. You can get the sample code in this gist.

I enjoyed putting together these presentations and tutorials.

Published by


Mac Admin, Consultant, and Author