{"id":19593182,"url":"https://github.com/thoughtbot/perform","last_synced_at":"2025-04-08T03:14:03.849Z","repository":{"id":62450603,"uuid":"66855909","full_name":"thoughtbot/Perform","owner":"thoughtbot","description":"Easy dependency injection for storyboard segues","archived":false,"fork":false,"pushed_at":"2021-09-24T16:05:08.000Z","size":68,"stargazers_count":280,"open_issues_count":4,"forks_count":12,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-05-09T08:01:27.920Z","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/thoughtbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-29T15:28:23.000Z","updated_at":"2023-09-02T12:59:50.000Z","dependencies_parsed_at":"2022-11-01T23:31:24.395Z","dependency_job_id":null,"html_url":"https://github.com/thoughtbot/Perform","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2FPerform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2FPerform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2FPerform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2FPerform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoughtbot","download_url":"https://codeload.github.com/thoughtbot/Perform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11T08:38:29.370Z","updated_at":"2025-04-08T03:14:03.820Z","avatar_url":"https://github.com/thoughtbot.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Perform\n\nEasy dependency injection for storyboard segues.\n\n```swift\nimport Perform\n\n// ...\n\nfunc tableView(_ tableView: UITableView, didSelectRowAt indexPath: NSIndexPath) {\n  let task = taskList[indexPath.row]\n  perform(.showTaskDetails) { taskVC in\n    taskVC.task = task\n  }\n}\n```\n\n## Usage\n\nConfigure your segues:\n\n```swift\n// Sources/Extensions/Segue.swift\nimport Perform\n\nextension Segue {\n  static var showTaskDetails: Segue\u003cTaskDetailsViewController\u003e {\n    return .init(identifier: \"ShowTaskDetails\")\n  }\n}\n```\n\nAnd then use `perform(_:prepare:)` instead of `performSegue(withIdentifier:sender:)`.\nThat's it!\n\n#### Type-safe segues\n\nPerform checks the type of the destination view controller and casts it for you,\nraising an error if your destination view controller is an unexpected type.\n\n#### Still works if your view controller is embedded in a container\n\nEver written code like this?\n\n```swift\nguard let nav = segue.destinationViewController as? UINavigationController,\n  let content = nav.rootViewController as? MyViewController\n  else { return }\n\n// ... finally! 😭\n```\n\nPerform takes care of this, searching the view controller hierarchy for a view\ncontroller of the matching type!\n\n#### No switch statements in `prepareForSegue(_:sender:)`\n\nMultiple segues from one view controller? No problem, just prepare each\ndestination view controller right where you perform the segue. No more massive\nswitch statements.\n\n#### Further reading\n\nFor more examples, and a discussion about the motivation and design of Perform,\ntake a look at the [introductory blog post][perform-blog].\n\n  [perform-blog]: https://robots.thoughtbot.com/introducing-perform-easy-dependency-injection-for-storyboard-segues\n\n## Installation\n\n### Compatibility\n\n| Swift Version | Perform Version |\n| ------------- | --------------- |\n| 3.x           | 2.x             |\n| 2.x           | 1.x             |\n\n### [Carthage][carthage-home]\n\nAdd the following to your Cartfile:\n\n```\ngithub \"thoughtbot/Perform\" ~\u003e 2.0\n```\n\nThen run `carthage update Perform`.\n\nFollow the instructions in [Carthage's README][carthage-readme] for up-to-date\ninstallation instructions.\n\n  [carthage-home]: https://github.com/Carthage/Carthage\n  [carthage-readme]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application\n\n### [CocoaPods][cocoapods]\n\nAdd the following to your Podfile:\n\n```\npod \"Perform\", \"~\u003e 2.0\"\n```\n\nSee the [CocoaPods guide][cocoapods-usage] for up-to-date installation\ninstructions.\n\n  [cocoapods]: https://cocoapods.org\n  [cocoapods-usage]: https://guides.cocoapods.org/using/using-cocoapods.html\n\n## Contributing\n\nSee the [CONTRIBUTING][] document.\n\n  [CONTRIBUTING]: CONTRIBUTING.md\n\n## License\n\nPerform is Copyright (c) 2016 thoughtbot, inc.\nIt is free software, and may be redistributed\nunder the terms specified in the [LICENSE] file.\n\n  [LICENSE]: LICENSE\n\n## About\n\n![thoughtbot](https://thoughtbot.com/logo.png)\n\nPerform is maintained and funded by thoughtbot, inc.\nThe names and logos for thoughtbot are trademarks of thoughtbot, inc.\n\nWe love open source software!\nSee [our other projects][community]\nor [hire us][hire] to help build your product.\n\n  [community]: https://thoughtbot.com/community?utm_source=github\n  [hire]: https://thoughtbot.com/hire-us?utm_source=github\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fperform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoughtbot%2Fperform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fperform/lists"}