A Swift framework that adds closure handlers to UIKit and Foundation classes, replacing delegation and target-action patterns.
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.
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.
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.
Swifty closures for UIKit and Foundation
Replaces verbose target-action and delegation with simple closures, as shown with button.onTap and tableView.addElements, significantly reducing boilerplate code.
Daisy chaining allows grouping related delegate methods, such as for UITextField, making code more readable and maintainable without scattering logic.
Supports mixing closure handlers with traditional delegate methods, as demonstrated with UITableView, allowing incremental adoption without a full rewrite.
As a specialized framework, it has a smaller community and fewer resources compared to mainstream libraries, which can slow down support and issue resolution.
The project's goal to become irrelevant if Apple adopts similar APIs means long-term maintenance is uncertain, risking obsolescence with iOS updates.
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.
Closures is an open-source alternative to the following products:
A handy collection of more than 500 native Swift extensions to boost your productivity.
Strong typed, autocompleted resources like images, fonts and segues in Swift projects
The Objective-C block utilities you always wish you had.
A tool to identify unused code in Swift projects.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.