Jamf Blog

Swift, JSS API and You!

Today’s session presenter, Joel Rennich, shared tips on how to leverage Swift with the JSS API to quickly create utilities and extend a user’s existing tools.

Watch this JNUC session in its entirety.

Know how to write a shell script? If yes, you can write in Apple’s newest programming language – Swift. Today’s session presenter, Joel Rennich, shared tips on how to leverage Swift with the JSS API to quickly create utilities and extend a user’s existing tools. As an example, he showed how to apply these capabilities to determine if a BYO Mac is enrolled, gather demographic data from a user and put the user’s Mac into a group within the JSS.

When using Swift with the JSS API for the first time, Rennich recommended an initial tip, “Write a wrapper or use someone else’s to keep you sane,” he said.

“You need to learn to live asynchronously. If you're used to bash scripts, this will take a little getting used to. But you can do it!”

As you get started with Swift, there are several other concepts to familiarize yourself with. Rennich showed examples of a Completion Handler (used to handle the asynchronous returns coming from the web server) and XML Parsers (with the recommendation to look at available parsing libraries to keep yourself sane.)

Some of the benefits of using Swift is that it's easy to integrate with macOS system APIs and build native user interface elements. Swift code can be complied to a signed binary to work with a GateKeeper protected system. As another advantage, Swift is the standard for all Apple development, so a useful skill to add to your tool belt.

Showing no fear of the “demo gods”, Rennich showed several live demos during the session. The audience was pleased to see an example of an app under development by Trusource Labs that guides a user through the BYOD enrollment process. He was met by thunderous applause when he added that the tool will be released to the community soon. Be sure to follow Trusource Labs, and watch Rennich’s code repo at gitlab.com/u/Mactroll.

Subscribe to the Jamf Blog

Have market trends, Apple updates and Jamf news delivered directly to your inbox.

To learn more about how we collect, use, disclose, transfer, and store your information, please visit our Privacy Policy.