Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. Then

Then

MITSwift3.0.0

A Swift library providing syntactic sugar for object initialization and configuration using closures.

GitHubGitHub
4.4k stars301 forks0 contributors

What is Then?

Then is a Swift library that provides syntactic sugar for initializing and configuring objects using closure-based syntax. It solves the problem of verbose object setup code by allowing developers to configure properties immediately after creation in a clean, readable way.

Target Audience

iOS/macOS developers working with Swift who want to write cleaner, more expressive initialization code, particularly when dealing with UIKit components or custom NSObject subclasses.

Value Proposition

Developers choose Then because it eliminates boilerplate initialization code, makes object configuration more readable, and integrates seamlessly with existing Swift patterns without requiring significant changes to code structure.

Overview

✨ Super sweet syntactic sugar for Swift initializers

Use Cases

Best For

  • Configuring UIKit components with multiple properties
  • Reducing boilerplate in view controller setup code
  • Making object initialization more readable in Swift
  • Extending custom types with convenient configuration syntax
  • Working with value types that need modified copies
  • Simplifying configuration of NSObject subclasses

Not Ideal For

  • Projects built exclusively with SwiftUI, as Then is optimized for UIKit and NSObject subclasses
  • Codebases that enforce a strict no-dependency policy for minimalism or security reasons
  • Simple object initializations where a standard Swift initializer or property assignment suffices without closure overhead
  • Teams that prefer vanilla Swift patterns and avoid syntactic sugar libraries to maintain codebase consistency

Pros & Cons

Pros

Closure-Based Initialization

Reduces boilerplate code by allowing property configuration in a trailing closure, making Swift code more readable, as shown in the UILabel example from the README.

Seamless NSObject Integration

Works out-of-the-box with all NSObject subclasses like UIKit components, requiring no additional setup for common iOS development tasks.

Custom Type Extensibility

Easily extend your own types by conforming to the Then protocol, enabling the same clean syntax for custom objects, as demonstrated in the tips section.

Value Type Modification

Provides the `with()` method to create modified copies of value types like CGRect, avoiding mutability issues in Swift, as highlighted in the README examples.

Cons

SwiftUI Incompatibility

Primarily designed for UIKit and NSObject, so it doesn't integrate well with SwiftUI's declarative syntax, limiting its relevance in modern iOS development trends.

Dependency Overhead

Adds a third-party library for functionality that can be replicated with standard Swift closures or computed properties, which might not be justified in lightweight projects.

Potential for Overuse

Over-reliance on the closure syntax can lead to less readable code if developers nest configurations excessively, contrary to Swift's emphasis on clarity.

Frequently Asked Questions

Quick Stats

Stars4,395
Forks301
Contributors0
Open Issues9
Last commit4 months ago
CreatedSince 2015

Tags

#developer-tools#code-style#ios-development#swift#initialization#swift-library#syntactic-sugar#uikit

Built With

S
Swift

Included in

iOS51.7kSwift26.0k
Auto-fetched 17 hours ago

Related Projects

SwifterSwiftSwifterSwift

A handy collection of more than 500 native Swift extensions to boost your productivity.

Stars15,142
Forks1,664
Last commit3 days ago
R.swiftR.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects

Stars9,569
Forks779
Last commit1 year ago
BlocksKitBlocksKit

The Objective-C block utilities you always wish you had.

Stars6,831
Forks1,246
Last commit8 years ago
PeripheryPeriphery

A tool to identify unused code in Swift projects.

Stars6,180
Forks232
Last commit14 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub