This is the app that we built during my 2019 PSU MacAdmins workshop on development. It is a simple tool that was designed to teach about different areas of Xcode and Swift development.
TokenUsers is a simple app that shows us all of the APFS Secure Token users on a system. On macOS there are a few different tools that show you parts of the info, but not all of it.
diskutil
will show you the UUID of the users with Secure Tokens. It won't resolve the names.
sysadminctl
will let you check a name to see if it has a Secure Token, but you need to enter the name, not the UUID.
TokenUsers, and the CLI version tokenusers
gives you a simple list of the users by both name and UUID. It's like peanut butter and chocolate, but with cryptographic tokens and user names.
Here is what the CLI output looks like:
Here is the GUI app:
If you start at the begining of the folders we first build the CLI app and transition to the GUI version. There are Swift Playgrounds in each step as well that you can use to get a feel for each API that we use along the way. Each step builds upon the last. Note that there is a seperate copy of the project in each folder. This way you can easily compare what was added.
If we were to look at the order in which you are exposed to concepts it looks like this...
- How to open a project in Xcode and build it.
- Running a tool with
Process
,URL
, andPipe
APIs. Also Xcode header doc generation. - Parsing plist content with
PropertyListDecoder
andCodable
. - Swift Error handling with
throws
, different styles oftry
, and a peek at theResult
type. - Searching for users with the
OpenDirectory
API and customError
types. - Parsing data with
map
andfor...in
techniques. - How to seperate data to a Model class and when either
class
orstruct
is appropriate. - Basics of Swift text formatting and interlopation.
- Using archiving in Xcode to make a distribution build.
- Adding a new target in Xcode and sharing code between your CLI and GUI apps. Also that whole GUI version thing.
Overall the entire thing makes more sense with me talking about it all day long. Maybe if I have some of that "free time" thing one day I can record videos of each step!
Enjoy.