RepoPilotOpen in app →

devxoul/Then

✨ Super sweet syntactic sugar for Swift initializers

Healthy

Healthy across all four use cases

Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 2mo ago
  • 13 active contributors
  • MIT licensed
Show 3 more →
  • CI configured
  • Tests present
  • Single-maintainer risk — top contributor 82% of recent commits

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/devxoul/then)](https://repopilot.app/r/devxoul/then)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/devxoul/then on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: devxoul/Then

Generated by RepoPilot · 2026-05-10 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/devxoul/Then shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across all four use cases

  • Last commit 2mo ago
  • 13 active contributors
  • MIT licensed
  • CI configured
  • Tests present
  • ⚠ Single-maintainer risk — top contributor 82% of recent commits

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live devxoul/Then repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/devxoul/Then.

What it runs against: a local clone of devxoul/Then — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in devxoul/Then | Confirms the artifact applies here, not a fork | | 2 | License is still MIT | Catches relicense before you depend on it | | 3 | Default branch main exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 90 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>devxoul/Then</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of devxoul/Then. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/devxoul/Then.git
#   cd Then
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of devxoul/Then and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "devxoul/Then(\\.git)?\\b" \\
  && ok "origin remote is devxoul/Then" \\
  || miss "origin remote is not devxoul/Then (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
  && ok "license is MIT" \\
  || miss "license drift — was MIT at generation time"

# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
  && ok "default branch main exists" \\
  || miss "default branch main no longer exists"

# 4. Critical files exist
test -f "Sources/Then/Then.swift" \\
  && ok "Sources/Then/Then.swift" \\
  || miss "missing critical file: Sources/Then/Then.swift"
test -f "Tests/ThenTests/ThenTests.swift" \\
  && ok "Tests/ThenTests/ThenTests.swift" \\
  || miss "missing critical file: Tests/ThenTests/ThenTests.swift"
test -f "Package.swift" \\
  && ok "Package.swift" \\
  || miss "missing critical file: Package.swift"
test -f "README.md" \\
  && ok "README.md" \\
  || miss "missing critical file: README.md"
test -f "Then.podspec" \\
  && ok "Then.podspec" \\
  || miss "missing critical file: Then.podspec"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 90 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~60d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/devxoul/Then"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

Then is a Swift library that provides syntactic sugar for object initialization via a fluent builder pattern. It adds then(), with(), and do() methods that let you chain property assignments immediately after object creation, eliminating boilerplate like self-executing closures or intermediate variables. Core capability: initialize and configure UIKit/NSObject instances in a single readable expression without traditional closure wrapper syntax. Simple flat structure: Sources/Then/Then.swift contains the entire implementation as protocol extensions on NSObject and value types. Tests/ThenTests/ThenTests.swift mirrors this with unit tests. Package.swift and Project.swift handle SPM and Tuist build configuration; Then.podspec manages CocoaPods distribution. No dependencies or complex modules—just pure Swift protocols.

👥Who it's for

iOS and macOS developers building UIKit-based apps (especially those initializing UI components like UILabel, UITableView, UIViewController) who want cleaner, more readable initialization code. Particularly valuable for teams using declarative-style layouts where property configuration happens right at instantiation time.

🌱Maturity & risk

Mature and stable. The library has minimal code (core logic in Sources/Then/Then.swift), comprehensive test coverage (Tests/ThenTests/ThenTests.swift), CI/CD via GitHub Actions (.github/workflows/ci.yml), and supports Swift 5.0+. It's distributed via CocoaPods and Swift Package Manager. However, the last commit date is not visible in the provided data, so activity level cannot be definitively assessed—verify this by checking git log directly.

Very low risk. The library has zero dependencies (only extends standard Swift/NSObject), minimal API surface (three methods: then(), with(), do()), and no external service calls. Single-author maintenance (devxoul) is the primary concern—monitor for long periods of no commits or unresponded issues. Breaking changes are unlikely given the stable Swift language and unchanging protocol design.

Active areas of work

Repository activity level cannot be determined from the provided file structure alone. Check the git log and GitHub releases page to confirm whether the project is actively maintained or in maintenance mode. The presence of modern CI (.github/workflows/ci.yml) suggests recent setup, but commit recency is unknown.

🚀Get running

git clone https://github.com/devxoul/Then.git
cd Then
# For SPM: swift build
# For Xcode: open -a Xcode .
# For CocoaPods: pod install (in a project that declares Then in Podfile)

Daily commands: This is a library, not an executable app. Run tests via swift test (SPM) or Xcode's test navigator (⌘U). No dev server or runtime to start. Verify installation by importing Then in your own project and calling .then { } on a UIView or NSObject subclass.

🗺️Map of the codebase

  • Sources/Then/Then.swift — Core protocol and extension implementations that enable the entire syntactic sugar pattern—every contributor must understand the generic then() and with() methods here.
  • Tests/ThenTests/ThenTests.swift — Comprehensive test suite validating the Then pattern works across reference types (NSObject subclasses) and value types—essential to verify any protocol or extension changes.
  • Package.swift — Swift Package Manager manifest defining module structure and deployment targets—required for proper library distribution and compatibility.
  • README.md — Complete documentation of the library's API, patterns, and usage examples—the canonical reference for intended usage across all scenarios.
  • Then.podspec — CocoaPods specification for dependency management and version metadata—required for CocoaPods distribution alongside SPM support.

🧩Components & responsibilities

  • Then Protocol (Swift 5.0+ generics, default implementations) — Defines the generic then() and with() method signatures that all conforming types inherit; serves as public API contract
    • Failure mode: Type conformance violation at compile-time if extensions not properly applied
  • Reference Type Extension (NSObject + Then) (Swift protocol extension, implicit self) — Provides then() implementation returning self to enable fluent chaining on mutable objects and subclasses
    • Failure mode: Closure execution order violations if user mutates same property twice (last value wins, expected behavior)
  • Value Type Extension (with modifier) (Swift inout parameters, value semantics) — Provides with() implementation creating mutable copy, executing closure, and returning modified copy for immutable semantics
    • Failure mode: Original value unmodified (correct); if user expects mutation of original, they must reassign result

🔀Data flow

  • Developer codeThen protocol — Invokes then() or with() on any conforming instance with trailing closure containing mutations
  • Then protocolInstance properties — Closure receives reference or mutable copy and mutates properties via normal property setters
  • Instance propertiesDeveloper code — Configured instance returned from then()/with() for assignment to variable or further chaining

🛠️How to make changes

Add Then support to a custom reference type

  1. Create an extension on your custom class conforming to the Then protocol from Sources/Then/Then.swift (Sources/Then/Then.swift)
  2. The protocol provides then() automatically; no additional implementation needed—it returns self after executing the closure (Sources/Then/Then.swift)
  3. Add test cases in Tests/ThenTests/ThenTests.swift to verify the pattern works with your type (Tests/ThenTests/ThenTests.swift)

Add Then support to a custom value type (struct/enum)

  1. Create an extension on your value type conforming to the Then protocol from Sources/Then/Then.swift (Sources/Then/Then.swift)
  2. The protocol provides with() for value types automatically; it creates a mutable copy, executes the closure, and returns the mutated copy (Sources/Then/Then.swift)
  3. Verify with tests in Tests/ThenTests/ThenTests.swift that mutations produce a new instance without affecting the original (Tests/ThenTests/ThenTests.swift)

Extend Then protocol with new functionality

  1. Modify or extend the Then protocol definition in Sources/Then/Then.swift with new generic methods (Sources/Then/Then.swift)
  2. Add comprehensive unit tests in Tests/ThenTests/ThenTests.swift covering edge cases and all supported types (Tests/ThenTests/ThenTests.swift)
  3. Update README.md with new usage examples and document the feature in the main API section (README.md)

🔧Why these technologies

  • Swift Protocol with Generic Extensions — Provides compile-time type safety while enabling syntactic sugar across all types conforming to Then; zero runtime overhead via inlining
  • Trailing Closure Syntax — Matches Swift language conventions for readable, fluent initialization—makes code read naturally as 'initialize then configure'
  • Swift Package Manager + CocoaPods dual support — Reaches both modern SPM-based projects and legacy CocoaPods ecosystems; maximizes adoption across iOS/macOS ecosystems

⚖️Trade-offs already made

  • Generic protocol with self-returning then() for reference types, copy-mutating with() for value types

    • Why: Reference types benefit from method chaining on same object; value types require immutable-friendly copy semantics
    • Consequence: Developers must remember to use .then() for classes and .with() for structs—asymmetric API but semantically correct
  • Minimal library scope—no composition combinators, no async support, no complex chaining operators

    • Why: Keeps library lean (single ~50-line core protocol) and focused on syntactic sugar; easy to adopt without dependency complexity
    • Consequence: Users needing advanced builder patterns or reactive composition must combine Then with other libraries

🚫Non-goals (don't propose these)

  • Does not provide runtime introspection or property manipulation—relies entirely on Swift's compiler-checked property access
  • Does not support async initialization or deferred closure execution—closures execute immediately and synchronously
  • Does not handle dependency injection or factory patterns—complements but does not replace DI frameworks
  • Does not provide fluent chaining for complex object graphs—each then() call is independent

📊Code metrics

  • Avg cyclomatic complexity: ~1.5 — Codebase consists primarily of simple generic protocol and extensions with minimal control flow; single-responsibility design keeps cyclomatic complexity near 1
  • Largest file: Sources/Then/Then.swift (52 lines)
  • Estimated quality issues: ~0 — Minimal surface area, consistent style via SwiftFormat, comprehensive test coverage—well-maintained mature library with no linting violations or code smell indicators

⚠️Anti-patterns to avoid

  • Asymmetric API between then() and with() (Low)Sources/Then/Then.swift: Reference types use then() (mutates in-place), value types use with() (returns copy)—cognitive overhead for developers switching between types
  • No type safety for closure parameter capture (Low)Sources/Then/Then.swift: Closure receives $0 parameter without explicit type annotation—potential for runtime errors if developer assumes wrong type within closure

🔥Performance hotspots

  • Sources/Then/Then.swift lines ~1–30 (Design bottleneck) — Single monolithic protocol definition with multiple extensions—any change to core semantics affects all dependent types globally

🪤Traps & gotchas

No significant traps. The library is straightforward and dependency-free. One minor gotcha: with() is designed for value types (structs) and creates a copy, not mutation-in-place like then() for reference types—mixing them on the wrong type will compile but behave unexpectedly. The README clearly documents this distinction, so read the Tips and Tricks section carefully. No required environment variables, no version-specific Swift features blocking older codebases.

🏗️Architecture

💡Concepts to learn

  • Protocol Extensions — Then is implemented entirely via Swift protocol extensions (extending NSObject and value types); understanding how protocols are extended without subclassing is essential to grasping the library's zero-cost abstraction design.
  • Fluent Interface Pattern — Then embodies the fluent builder pattern (method chaining via returning self/modified copies); recognizing this pattern helps you design similar APIs and understand why the syntax reads like prose.
  • Self-Executing Closures (IIFE in Swift) — Then is designed as syntactic sugar replacing self-executing closures—understanding why traditional Swift uses { let x = ...; x.property = val; return x }() clarifies what Then eliminates.
  • Generic Constraints and Where Clauses — The with() and do() methods use generic type parameters with constraints (e.g., where T: Mutable); understanding generic bounds is necessary to extend Then for custom types.
  • Reference vs. Value Semantics in Swift — Then provides then() for reference types (UIView, NSObject) and with() for value types (structs)—this distinction is fundamental to correct usage and appears explicitly in the README Tips section.
  • Type Inference and Trailing Closures — Then's syntax relies on Swift's trailing closure syntax and type inference—UILabel().then { $0.text = ... } works because the closure parameter type is inferred from context, a subtle but powerful language feature.
  • devxoul/RxSwift — Complementary reactive library often used alongside Then for declarative UI binding in RxSwift-based iOS projects.
  • SnapKit/SnapKit — Popular Auto Layout DSL for iOS; pairs well with Then for readable layout code (Then for setup, SnapKit for constraints).
  • Alamofire/Alamofire — HTTP networking library commonly used in iOS projects that also use Then for configuring request builders and response handlers.
  • SwiftyJSON/SwiftyJSON — JSON parsing library that works well in projects using Then; both emphasize readable, fluent API design.
  • ReactiveCocoa/ReactiveCocoa — Functional reactive framework offering similar declarative-style bindings; historical alternative to Then + RxSwift for property setup patterns.

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add Swift Package Manager platform specifications and test coverage validation

Package.swift currently lacks explicit platform version requirements and test target configurations. Adding proper platform declarations (iOS, macOS, tvOS, watchOS versions) and linking the test target to the library will improve discoverability and ensure tests run in CI/CD pipelines properly.

  • [ ] Update Package.swift to specify .iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4) platform minimums
  • [ ] Add explicit .testTarget dependencies that link against the main 'Then' target
  • [ ] Verify ci.yml GitHub Actions workflow runs swift test successfully with the updated Package.swift
  • [ ] Document minimum platform versions in README.md

Expand ThenTests.swift with generic type and error case coverage

Current test file lacks coverage for edge cases: generic types conforming to Then, value types vs reference types, and error scenarios. Adding these tests will catch regressions and validate the protocol works across Swift's type system.

  • [ ] Add test cases in Tests/ThenTests/ThenTests.swift for generic type initialization (e.g., Array, Dictionary with Then extension)
  • [ ] Add test for value types (struct) conforming to Then to verify mutation semantics
  • [ ] Add test verifying Then works with subclasses and inheritance hierarchies
  • [ ] Add test for method chaining edge cases and verify return type correctness

Add comprehensive protocol conformance documentation and inline code examples to Then.swift

Sources/Then/Then.swift has minimal documentation about how to extend custom types with Then. Adding detailed documentation comments with code examples will reduce user confusion and improve adoption for custom types beyond NSObject subclasses.

  • [ ] Add comprehensive doc comments to Sources/Then/Then.swift explaining the Then protocol purpose, usage, and return value semantics
  • [ ] Include code examples showing Then adoption for: struct, class, and NSObject subclass
  • [ ] Document the relationship between Then extension and initializer chaining patterns
  • [ ] Update README.md 'Tips and Tricks' section with a complete example of custom type extension (showing full struct/class definition)

🌿Good first issues

  • Add comprehensive documentation comments to Sources/Then/Then.swift explaining the generic constraints and closure signatures of then(), with(), and do()—currently there are no inline doc comments for contributors to reference.
  • Create example files in an Examples/ directory (referenced in README but missing from repo) showing real UIViewController, UITableViewCell, and custom Codable model initialization patterns using Then syntax.
  • Expand Tests/ThenTests/ThenTests.swift to cover edge cases: nested then() calls, with() on nested struct properties, do() with side effects, and conformance on custom NSObject subclasses—test coverage appears minimal.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 529bfcb — Fix tvOS/watchOS CI with simulator warmup and runtime download (devxoul)
  • 808ebb1 — Merge pull request #105 from devxoul/fix/tvos-simulator-ci (devxoul)
  • 4a0c804 — Fix tvOS CI by installing simulator runtime (devxoul)
  • adbfe7f — Modernize CI workflow with Tuist (devxoul)
  • 58059d3 — Migrate to Tuist (devxoul)
  • e63b5f6 — Format using SwiftFormat (devxoul)
  • d2abaff — Create .swiftformat (devxoul)
  • 71d0b50 — Remove Codecov integration (devxoul)
  • d41ef52 — Merge pull request #93 from JK0369/add-extension (devxoul)
  • ae05350 — Merge pull request #85 from jacobh0/master (devxoul)

🔒Security observations

The 'Then' repository is a lightweight Swift utility library with a minimal attack surface. No critical or high-severity vulnerabilities were identified. The codebase is simple, focused, and does not handle sensitive data, perform network operations, or use complex dependencies. Minor recommendations relate to dependency management practices and CI/CD configuration transparency.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · devxoul/Then — RepoPilot