[Video] Swift Argument Parser with Guilherme Rambo

Published: January 15, 2025
Written by:
Natan Rolnik
Natan Rolnik

If you’ve read previous posts and series, you already know how this website likes the Swift Argument Parser. For this video, we invited another fan of the Swift Argument Parser to join us: Guilherme Rambo.

Rambo is an independent security researcher in the Apple ecosystem, and macOS developer, known mostly for the AirBuddy app. While working on his own tools and frameworks, he has extensively used the Argument Parser to help in their development.

In this video, we talk about building Command Line tools in Swift, and more specifically:

  • How the Swift Argument Parser can help you build them - even if you just want a simple CLI to help using and testing your packages.
  • Refactoring the ocrit tool, making it use more advanced APIs of the argument parser, and use the PathKit package to make it more type-safe.
  • Showing another tool, Asset Catalog Tinkerer, which is a regular macOS app, but in its Xcode project it also has a command line target with similar functionality.

Chapters:

  • 00:00 Intro
  • 06:58 ocrit: Background Story
  • 10:53 ocrit: Adding PathKit
  • 17:57 The validate() Function
  • 31:26 ExpressibleByArgument & Custom Types
  • 45:30 The @main Attribute
  • 51:12 Asset Catalog Tinkerer

To view all the changes we made to ocrit, check out the Pull Request mentioned in the video.

Swift, Xcode, the Swift Package Manager, iOS, macOS, watchOS and Mac are trademarks of Apple Inc., registered in the U.S. and other countries.

© Swift Toolkit, 2024-2025