~/talk

Make your own code formatter in Swift

Talkat iOS Conf Singapore 2019 · on Saturday, 2019-01-19· [swift, developer-experience]

Team inconsistency motivates building a real formatter that actually rewrites code, not just enforces rules. It uses SwiftSyntax to parse a lossless AST and implements concrete edits like semicolon trimming, inserting numeric underscores, and turning nested if into guard. The proof is an open source formatter called swiftlylighter that applies these edits and runs on real code; it combines AST editing with lenses and prisms (optics) for deep traversal and notes some performance limits now but improvements land with newer Swift.

AI-written summary · about

  1. 0:00Introduction
  2. 1:21Coding Styles
  3. 6:16Swift ASP Explore
  4. 11:10Swift Formal Grammar
  5. 20:28Optics
  6. 26:46Composite optics
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.