#84: Nested Types in Swift
If a type exists only to support another type, nesting it can keep your API cleaner.
struct HTTPRequest {
enum Method {
case get, post, put, delete
}
var method: Method
}
This avoids polluting the module namespace with tiny helper types that do not make sense on their own.
Nested types are especially useful for state enums, configuration structs and lightweight namespaces.