Swift Scripts: Zero to Hero
summary
Shows how to build a real Swift command‑line tool using Swift Package Manager executables, explains the role of main.swift, argument parsing with ArgumentParser, and handling inputs via CommandLine.arguments, FileHandle pipelines and Process.environment. Demonstrates interactive readline use, exit codes, and a progress UI from swift‑tools‑support‑core for terminal feedback. Covers packaging: build with swift build -c release, copy the resulting binary from .build/release into /usr/local/bin, and confirms the executable runs as expected.
AI-written summary · about
chapters (14)
- 0:00Intro
- 1:40CREATING AN EXECUTABLE
- 2:16THE PACKAGE STRUCTURE
- 3:15PACKAGE.SWIFT
- 4:47BUILD RUN TEST
- 6:02LAUNCH ARGUMENTS
- 8:34INTERACTIVE
- 9:38ENVIRONMENT VARIABLES
- 11:06PIPELINE MESSAGES
- 14:24ARGUMENTPARSER
- 18:34SWIFTTOOLSSUPPORT'S
- 19:11ADDING A DEPENDENCY 2
- 19:38PROGRESS STATE
- 21:59USE THE SCRIPT ANYWHERE
related talks
30mBuilding Swift Command Line Tools
29mSwift Scripting in Practice
38mBuilding CLI Tools in Swift
27mSwift scripting in practice
44mSwift Packages - Dependency Management of the Future
32mBuilding command-line user experiences with Swift
24mThinking Outside the Box with Swift Package Manager
19mSwift to the cloud in a single step
