Then adds then(), with(), and do() helpers so you configure objects and value types in a single expression. It works on NSObject subclasses and custom types via extensions.
Overview
Then is a small Swift package that wraps object and value initialization with closure-based configuration. The then() helper creates an instance, runs a mutating closure, and returns the configured value, which reduces separate allocation and property assignment steps for UIKit types and other NSObject subclasses.
Extensions let you adopt the same pattern on your own structs and classes. with() targets value-type copying when you want to adjust a duplicate, and do() runs a scoped action with less ceremony for side effects inside larger setup code.
Documentation shows typical UIViewController setup where labels, constraints, and subviews are configured inline. The API is aimed at readability in application code rather than runtime services or standalone tools.
Key features
- then() for NSObject subclasses
- Custom type extensions supported
- with() for value-type copies
- do() for concise scoped actions
Use cases
- Configure UIKit views inline
- Tidy view controller setup code
- Apply extensions to custom models