Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. Closures

Closures

MITSwift0.7.0

A Swift framework that adds closure handlers to UIKit and Foundation classes, replacing delegation and target-action patterns.

GitHubGitHub
1.7k stars168 forks0 contributors

What is Closures?

Closures is a Swift framework that adds closure-based handlers to UIKit and Foundation classes, providing an alternative to traditional iOS design patterns like delegation and target-action. It allows developers to write more concise and functional code for handling user interactions, populating views, and managing control events. The framework is designed to be type-safe and scalable, avoiding Objective-C runtime tricks.

Target Audience

iOS developers who prefer functional programming styles or want to reduce boilerplate code when working with UIKit and Foundation APIs. It's particularly useful for those building iOS apps with Swift and looking for more expressive alternatives to delegation.

Value Proposition

Developers choose Closures because it offers a Swifty, type-safe way to replace verbose delegation and target-action patterns with clean closure syntax. Its flexibility allows mixing traditional methods with closure handlers, and its daisy-chaining feature makes code organization intuitive.

Overview

Swifty closures for UIKit and Foundation

Use Cases

Best For

  • Replacing UIControl target-action patterns with closure handlers
  • Simplifying UITableView and UICollectionView data source implementation
  • Adding gesture recognizers with concise closure syntax
  • Organizing UITextField delegate methods using daisy chaining
  • Handling UIImagePickerController media selection with closures
  • Writing functional-style iOS code without Objective-C runtime dependencies

Not Ideal For

  • Projects with strict no-third-party-dependency policies for security or compliance reasons
  • Teams maintaining large Objective-C codebases where Swift closure integration adds complexity
  • Applications primarily built with SwiftUI, as Closures is focused on UIKit and Foundation classes

Pros & Cons

Pros

Concise Closure Syntax

Replaces verbose target-action and delegation with simple closures, as shown with button.onTap and tableView.addElements, significantly reducing boilerplate code.

Organized Delegate Handling

Daisy chaining allows grouping related delegate methods, such as for UITextField, making code more readable and maintainable without scattering logic.

Flexible Integration

Supports mixing closure handlers with traditional delegate methods, as demonstrated with UITableView, allowing incremental adoption without a full rewrite.

Cons

Niche Adoption Risks

As a specialized framework, it has a smaller community and fewer resources compared to mainstream libraries, which can slow down support and issue resolution.

Dependency on API Evolution

The project's goal to become irrelevant if Apple adopts similar APIs means long-term maintenance is uncertain, risking obsolescence with iOS updates.

Closure-Related Complexity

Extensive use of closures can lead to memory management issues like retain cycles if not carefully handled, requiring extra attention to [weak self] in examples.

Open Source Alternative To

Closures is an open-source alternative to the following products:

B
BlocksKit

BlocksKit is an Objective-C framework that extends the Cocoa framework with block-based APIs, making it easier to write concise and readable code for iOS and macOS development.

Frequently Asked Questions

Quick Stats

Stars1,748
Forks168
Contributors0
Open Issues25
Last commit5 years ago
CreatedSince 2017

Tags

#foundation#functional-programming#ios#uicontrol#delegation#mobile-development#cocoapods#swift#carthage#closures#uikit

Built With

S
Swift

Included in

iOS51.7kSwift26.0k
Auto-fetched 1 day ago

Related Projects

SwifterSwiftSwifterSwift

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

Stars15,034
Forks1,670
Last commit11 days ago
R.swiftR.swift

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

Stars9,590
Forks781
Last commit1 year ago
BlocksKitBlocksKit

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

Stars6,840
Forks1,252
Last commit8 years ago
PeripheryPeriphery

A tool to identify unused code in Swift projects.

Stars6,087
Forks228
Last commit7 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