{"id":2384,"url":"https://github.com/muukii/Presenter","last_synced_at":"2025-08-02T23:33:19.130Z","repository":{"id":62451067,"uuid":"57139839","full_name":"muukii/Presenter","owner":"muukii","description":"Screen transition with safe and clean code.","archived":false,"fork":false,"pushed_at":"2016-10-25T08:43:29.000Z","size":70,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-27T18:48:30.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/muukii.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":"2016-04-26T15:28:44.000Z","updated_at":"2020-08-25T11:23:04.000Z","dependencies_parsed_at":"2022-11-01T23:46:05.304Z","dependency_job_id":null,"html_url":"https://github.com/muukii/Presenter","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muukii%2FPresenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muukii%2FPresenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muukii%2FPresenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muukii%2FPresenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muukii","download_url":"https://codeload.github.com/muukii/Presenter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228503196,"owners_count":17930534,"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-01-05T20:16:12.456Z","updated_at":"2024-12-06T17:31:02.724Z","avatar_url":"https://github.com/muukii.png","language":"Swift","funding_links":[],"categories":["UI"],"sub_categories":["Transition","Layout","Other free courses"],"readme":"# Presenter\n\n[![CI Status](http://img.shields.io/travis/muukii/Presenter.svg?style=flat)](https://travis-ci.org/muukii/Presenter)\n[![Version](https://img.shields.io/cocoapods/v/Presenter.svg?style=flat)](http://cocoapods.org/pods/Presenter)\n[![License](https://img.shields.io/cocoapods/l/Presenter.svg?style=flat)](http://cocoapods.org/pods/Presenter)\n[![Platform](https://img.shields.io/cocoapods/p/Presenter.svg?style=flat)](http://cocoapods.org/pods/Presenter)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nScreen transition with safe and clean code.\n\nWith Presenter, you can…\n- Assure that the ViewController's requirements are met, such as a ViewModel to be injected.\n- Constrain transition types (push or present modal or both)\n\n**This library is recommended to be used together with [Instantiatable](https://github.com/muukii/Instantiatable).**\n\n## Usage\n\n### Clean Screen Transition\n\n```swift\nMyViewController.Presenter(userID: \"muukii\").push(self.navigationController)\nMyViewController.Presenter(userID: \"muukii\").present(self)\n```\n\n#### Advanced\n\n```swift\nMyViewController.Presenter(userID: \"muukii\").push(self.navigationController) { (transaction: PushTransaction\u003cMyViewController\u003e in\n\n    // Pop    \n    transaction.pop()\n\n    // Get\n    transaction.viewController\n}\n\nMyViewController.Presenter(userID: \"muukii\").present(self) { (transaction: ModalTransaction\u003cMyViewController\u003e) in\n\n    // Pop    \n    transaction.dismiss()\n\n    // Get\n    transaction.viewController\n}\n```\n\n\n### Create Presenter\n\nPush\n\n```swift\nextension MyViewController {\n\n    final class Presenter: PushPresenter {\n\n        let userID: String\n\n        init(userID: String) {\n            self.userID = userID\n        }\n\n        func createViewController() -\u003e MyViewController {\n            let controller = MessagesViewController() // Init from Stroyboard or XIB\n            controller.userID = userID\n            return controller\n        }  \n        \n        // Optional:\n        \n        public func willPush(viewController: MyViewController) {\n        \n        }\n    \n        public func didPush(viewController: MyViewController) {\n        \n        }\n    }\n}\n```\n\nPresent\n\n```swift\nextension MyViewController {\n\n    final class Presenter: ModalPresenter {\n\n        let userID: String\n\n        init(userID: String) {\n            self.userID = userID\n        }\n\n        func parentController(viewController: UIViewController) -\u003e UIViewController? {\n            return UINavigationController(rootViewController: viewController)\n        }\n\n        func createViewController() -\u003e MyViewController {\n            let controller = MessagesViewController() // Init from Stroyboard or XIB\n            controller.userID = userID\n            return controller\n        }   \n        \n        // Optional\n        \n        public func willPresent(viewController: MyViewController) {\n        \n        }\n    \n        public func didPresent(viewController: MyViewController) {\n        \n        }\n    }\n}\n```\n\nPresent or Push\n\n```swift\nextension MyViewController {\n\n    final class Presenter: PushPresenter, ModalPresenter {\n\n        let userID: String\n\n        init(userID: String) {\n            self.userID = userID\n        }\n\n        func parentController(viewController: UIViewController) -\u003e UIViewController? {\n            // Call Present() only\n            return UINavigationController(rootViewController: viewController)\n        }\n\n        func createViewController() -\u003e MyViewController {\n            let controller = MessagesViewController() // Init from Stroyboard or XIB\n            controller.userID = userID\n            return controller\n        }    \n        \n        // Optional\n        \n        public func willPresent(viewController: MyViewController) {\n        \n        }\n    \n        public func didPresent(viewController: MyViewController) {\n        \n        }\n        \n        public func willPush(viewController: MyViewController) {\n        \n        }\n    \n        public func didPush(viewController: MyViewController) {\n        \n        }\n    }\n}\n```\n\n## Requirements\n\n## Installation\n\nPresenter is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"Presenter\"\n```\n\n## Author\n\nmuukii, m@muukii.me\n\n## License\n\nPresenter 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%2Fmuukii%2FPresenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuukii%2FPresenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuukii%2FPresenter/lists"}