← Back to CV
Developer Tooling
Swift Code Generators
AST-based code generation tools that parse Swift source files and emit test/view boilerplate
2020
Swift 5
swift-ast (yanagiba)
ArgumentParser
iostream
Rainbow
Overview
ViewGenerator and VIPTestsGenerator are command-line tools that parse Swift source files using the swift-ast library and generate boilerplate code. ViewGenerator creates UIView/UITableViewCell/UICollectionViewCell scaffolding with SnapKit constraints via an interactive terminal UI. VIPTestsGenerator reads VIP architecture scene files, parses protocol declarations from the AST, and auto-generates XCTest files with mock injectors for each VIP boundary.
Highlights
- — Applied compiler theory to developer tooling: parse Swift source into ASTs and emit type-correct test boilerplate as a compiler phase problem
- — Designed a protocol-oriented AST abstraction layer that adapts third-party parser output into a minimal domain-specific tree
- — Implemented intelligent type synthesis for mock generation: Bool for void methods, direct types for single-param, synthesized tuples for multi-param
- — Built an interactive terminal UI from scratch using raw termios mode, ANSI escape sequences, and a character-level state machine