{"id":18389324,"url":"https://github.com/rightpoint/actionable","last_synced_at":"2026-03-05T13:02:45.209Z","repository":{"id":56901526,"uuid":"170553865","full_name":"Rightpoint/Actionable","owner":"Rightpoint","description":"A cleaner delegation pattern for iOS.","archived":false,"fork":false,"pushed_at":"2019-02-15T15:52:08.000Z","size":7704,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T10:36:16.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rightpoint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-13T17:59:48.000Z","updated_at":"2020-05-04T08:41:28.000Z","dependencies_parsed_at":"2022-08-20T18:50:36.538Z","dependency_job_id":null,"html_url":"https://github.com/Rightpoint/Actionable","commit_stats":null,"previous_names":["raizlabs/actionable"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Rightpoint/Actionable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FActionable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FActionable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FActionable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FActionable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rightpoint","download_url":"https://codeload.github.com/Rightpoint/Actionable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FActionable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30127218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T12:40:50.676Z","status":"ssl_error","status_checked_at":"2026-03-05T12:39:32.209Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:42:37.209Z","updated_at":"2026-03-05T13:02:45.176Z","avatar_url":"https://github.com/Rightpoint.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Actionable\n\n[![CI Status](https://img.shields.io/travis/nevillco/Actionable.svg?style=flat)](https://travis-ci.org/nevillco/Actionable)\n[![Version](https://img.shields.io/cocoapods/v/Actionable.svg?style=flat)](https://cocoapods.org/pods/Actionable)\n[![License](https://img.shields.io/cocoapods/l/Actionable.svg?style=flat)](https://cocoapods.org/pods/Actionable)\n[![Platform](https://img.shields.io/cocoapods/p/Actionable.svg?style=flat)](https://cocoapods.org/pods/Actionable)\n\nActionable makes it easier to adopt iOS conventions around the delegation pattern, with less boilerplate.\n\n## About\n\nWhen you want to relay actions to an object's owner in iOS, it’s common to use the delegate pattern. In builtin classes, this pattern looks like:\n```swift\nprotocol UITextFieldDelegate: class {\n    \n    func textFieldDidBeginEditing(UITextField)\n    ...\n    func textFieldDidEndEditing(UITextField, reason: UITextField.DidEndEditingReason)\n    \n}\n```\nYou’re encouraged to pass the object doing the delegation - in this case, the `UITextField`, back in the function. This naming convention can get verbose, but it has benefits. You might be delegating multiple `UITextField`s, and use a switch statement to disambiguate. It also makes clear to the developer that a particular function *belongs* to `UITextFieldDelegate`, whereas some `func didBeginEditing()` is more unclear.\n\nBut maintaining this style as you develop can be tedious and carry a lot of boilerplate, especially for larger delegates. **Actionable** leverages [Sourcery](https://github.com/krzysztofzablocki/Sourcery) code generation to make these delegate protocols easier to write and express.\n\n## Usage\n\nFirst, add the build phase that performs the code generation. Insert it prior to the `Compile Sources` phase. Specify your input files (`-i`) and the file where your output will be generated (`-o`). Make sure the output file is added to your Xcode project.\n\n```bash\n$PODS_ROOT/Actionable/actionable.sh -i $PROJECT_DIR/ -o $PROJECT_DIR/Generated/Actionable+Generated.swift\n```\n\nNow you're ready to add your delegates. To conform to Actionable, simply declare a delegate and a set of actions:\n\n```swift\nclass TableViewCell: UITableViewCell, Actionable {\n\n    // Conforming to Actionable\n    weak var delegate: Delegate?\n    enum Action {\n        case didTapButton\n    }\n    \n    func doSomething() {\n        // notify the delegate that something happened\n        notify(.didTapButton)\n    }\n    \n}\n```\n\nAnd on the other side, conform to the newly generated delegate.\n\n```swift\nclass TableViewController: UITableViewController, TableViewCellDelegate {\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -\u003e UITableViewCell {\n        let cell = tableView.dequeueReusableCell(\n            withIdentifier: TableViewCell.reuseID, for: indexPath)\n            as! TableViewCell\n        // assign the controller as the cell’s delegate\n        cell.delegate = self\n        return cell\n    }\n\n    // TableViewCellDelegate, and this function, were generated for you\n    func tableViewCell(_ cell: TableViewCell, didNotify action: TableViewCell.Action) {\n        switch action {\n        case .didTapButton:\n            print(\"Message received!\")\n        }\n    }\n\n}\n```\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first. You'll see a sample table view, whose buttons send an event all the way up to `AppDelegate` via the Actionable pattern.\n\n## Requirements\n\n## Installation\n\nActionable is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Actionable'\n```\n\n## Author\n\nConnor Neville, cneville@rightpoint.com\n\n## License\n\nActionable is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Factionable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frightpoint%2Factionable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Factionable/lists"}