{"id":13466966,"url":"https://github.com/marcosgriselli/EasyTransitions","last_synced_at":"2025-03-26T00:31:45.492Z","repository":{"id":43189760,"uuid":"128510234","full_name":"marcosgriselli/EasyTransitions","owner":"marcosgriselli","description":"A simple way to create custom interactive UIViewController transitions","archived":false,"fork":false,"pushed_at":"2022-10-06T00:15:39.000Z","size":48637,"stargazers_count":1676,"open_issues_count":12,"forks_count":90,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-03-25T03:13:46.264Z","etag":null,"topics":["animations","interaction","ios","swift","transition","ui","ux"],"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/marcosgriselli.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":"2018-04-07T08:29:25.000Z","updated_at":"2025-03-20T15:14:33.000Z","dependencies_parsed_at":"2022-09-13T20:20:38.591Z","dependency_job_id":null,"html_url":"https://github.com/marcosgriselli/EasyTransitions","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosgriselli%2FEasyTransitions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosgriselli%2FEasyTransitions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosgriselli%2FEasyTransitions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosgriselli%2FEasyTransitions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcosgriselli","download_url":"https://codeload.github.com/marcosgriselli/EasyTransitions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245388782,"owners_count":20607165,"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":["animations","interaction","ios","swift","transition","ui","ux"],"created_at":"2024-07-31T15:00:51.843Z","updated_at":"2025-03-26T00:31:45.480Z","avatar_url":"https://github.com/marcosgriselli.png","language":"Swift","funding_links":[],"categories":["Libs","HarmonyOS","UI [🔝](#readme)","Swift"],"sub_categories":["UI","Windows Manager"],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"Assets/banner.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-4.2-green.svg\" /\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Platforms-iOS%20%7C%20tvOS-blue.svg?style=flat\" /\u003e\n    \u003ca href=\"https://cocoapods.org/pods/EasyTransitions\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/EasyTransitions.svg\" alt=\"CocoaPods\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codebeat.co/projects/github-com-marcosgriselli-easytransitions-master\"\u003e\n      \u003cimg src=\"https://codebeat.co/badges/633fb33d-66b6-4034-93c0-0f52c5d0e15c\" alt=\"Codebeat\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n**EasyTransitions** is a library that helps developers create custom interactive transitions using simple functions defined in a protocol and avoid handling with the mutiple transitions API's in UIKit.\n\n## ⚠️ This library is a Work In Progress expect many changes until it reaches 1.0 ⚠️\n\nThe development roadmap will be documented using Github issues, milestones and project. Contributions are welcome! \n\n## 🌟 Features\n\n- [x] Custom transitions simple set up\n- [x] Support for Modal Presentations, UIPresentationController and UINavigationController transitions\n- [x] Interactive transition support in 1 line with multiple pan gesture directions\n- [x] 3 custom transitions as examples\n- [x] iOS \u0026 tvOS \n\n## 📲 Installation\n\n#### Using [CocoaPods](https://cocoapods.org)\n\nEdit your `Podfile` and specify the dependency:\n\n```ruby\npod 'EasyTransitions'\n```\n\n#### Using [Carthage](https://github.com/carthage)\n\nEdit your `Cartfile` and specify the dependency:\n\n```bash\ngithub \"marcosgriselli/EasyTransitions\"\n```\n\n## 👩‍💻 How to use\n\n### Transitions\n\nGiven that `UIViewControllerAnimatedTransitioning` works differently for Modal presentations and `UINavigationController` transitions I've split the functionality in: \n\n* `ModalTransitionConfigurator`\n* `NavigationTransitionConfigurator`\n\nEach of them grabs the available views to perfrom the transition. As read in the docs I avoid grabbing the views directly from the `UIViewControllers` and access them via `UIViewControllerContextTransitioning`'s `view(forKey: UITransitionContextViewKey)`. \n\n#### Modal transitions\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/marcosgriselli/EasyTransitions@40b7070bf28bca6938207f670c6f9c76cfd160da/app_store_short.gif\" width=\"200px\"/\u003e\n\nDesigns from [Meng To](https://twitter.com/mengto)'s [Design+Code](https://designcode.io)\n\n```swift \npublic protocol ModalTransitionAnimator {\n    var duration: TimeInterval { get }\n    var onDismissed: (() -\u003e Void)? { get set }\n    var onPresented: (() -\u003e Void)? { get set }\n    func layout(presenting: Bool,\n                modalView: UIView,\n                in container: UIView)\n    func animate(presenting: Bool,\n                 modalView: UIView,\n                 in container: UIView) \n}\n```\n\nDuring a modal transition we should only manage the view that is being presented modaly (modalView). We can inject animations on the root controller anyway.\n\nThe `ModalTransitionAnimator` is a really straight forward protocol. Just layout the views ready to be animated on `layout` function and perform the animations on `animate`. You can check the [AppStoreAnimator](https://github.com/marcosgriselli/EasyTransitions/blob/master/EasyTransitions/Classes/Animators/AppStoreAnimator.swift) for a basic example. \n\n#### UINavigationController transitions\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/marcosgriselli/EasyTransitions@d0d5b005a4a8ff87ed8426d0d945dea6cdbc456a/Resources/Gifs/navigation.gif\" width=\"200px\"/\u003e\n\n`UINavigationController` have a slightly different approach. Both the _from_ and _to_ view are accessible using `view(forKey: UITransitionContextViewKey)` so we add them to the protocol functions. \n\n```swift \npublic protocol NavigationTransitionAnimator {\n    var duration: TimeInterval { get }\n    var auxAnimations: (Bool) -\u003e [AuxAnimation] { get set }\n    func layout(presenting: Bool, fromView: UIView,\n                toView: UIView, in container: UIView)\n    func animations(presenting: Bool,\n                    fromView: UIView, toView: UIView,\n                    in container: UIView)\n}\n```\n\nI've added the auxiliary animations as part of the protocol but expect multiple changes in this area. \n\n#### UIPresentationController transitions\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/marcosgriselli/EasyTransitions@e9132c9833391ebfd7d9c4d085c81a0b468a13a0/presentationController.gif\" width=\"200px\"/\u003e\n\n`UIPresentationController` follows the same approach as Modal presentations. The only thing you need to call is `func set(presentationController: UIPresentationController?)` on your `ModalTransitionDelegate` object. \n\n### Interaction\n\n`TransitionInteractiveController` handles wiring a `UIPanGestureRecognizer` to the current `UIViewController`. This works for any action as we should set the `navigationAction: () -\u003e Void` for the interaction to work. This let's us use the same `TransitionInteractiveController` class for Modal, `UINavigationController` or even `UITabBarController` transitions. \n\nIt's wiring takes a `UIViewController` and a `Pan` object. EasyTransitions handles the swiping automatically. It responds to velocity and completness percentage to finish the transition. I plan to support configuring this. \n\nRight now the transition will complete if we stop swiping when it's over 50% or if we swipe fast or release. It will cancel it self if we swipe fast and release in the oposite direction.\n\n#### Pan \n\nThe `Pan` enum is a simple way to unify `UIPanGestureRecognizer` and `UIScreenEdgePanGestureRecognizer`. Internally EasyTransitions uses `TransitionPanGestureRecognizer` and `TransitionEdgePanGestureRecognier` to support a `PanGesture` protocol which calculates velocity and translation for each gesture and the correct sign they should have. \n\n```swift \npublic enum Pan {\n    case regular(PanDirection)\n    case edge(UIRectEdge)\n}\n```\n\n### Example\n\nThere's an example on `TodayCollectionViewController` but there should't be many changes on other implementations. Here's a generic example: \n\n```swift \nclass MainViewController: UIViewController {\nvar modalTransitionDelegate = ModalTransitionDelegate()\n\nfunc showDetailViewController() {\n\tlet detailController = DetailViewController()\n\tlet animator = MyAnimator() // ModalTransitionAnimator\n\tmodalTransitionDelegate.set(animator: animator)\n\tmodalTransitionDelegate.wire(viewController: detailController,\n                            \t  with: .regular(.fromTop),\n\t\t\t\t  navigationAction: {\n                detailController.dismiss(animated: true, completion: nil) \n\t})\n        \n\tdetailController.transitioningDelegate = modalTransitionDelegate\n\tdetailController.modalPresentationStyle = .custom\n        \n\tpresent(detailController, animated: true, completion: nil)\n}\n```\n\n## ❤️ Contributing\nThis is an open source project, so feel free to contribute. How?\n- Open an [issue](https://github.com/marcosgriselli/EasyTransitions/issues/new).\n- Send feedback via [twitter](https://twitter.com/marcosgriselli).\n- Propose your own fixes, suggestions and open a pull request with the changes.\n\nSee [all contributors](https://github.com/marcosgriselli/EasyTransitions/graphs/contributors)\n\n[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/0)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/0)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/1)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/1)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/2)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/2)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/3)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/3)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/4)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/4)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/5)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/5)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/6)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/6)[![](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/images/7)](https://sourcerer.io/fame/marcosgriselli/marcosgriselli/EasyTransitions/links/7)\n\n\n## 👨‍💻 Author\nMarcos Griselli | \u003ca href=\"url\"\u003e\u003cimg src=\"https://cdn.rawgit.com/marcosgriselli/ViewAnimator/cf065e96/Resources/twitterLogo.svg\" height=\"17\"\u003e\u003c/a\u003e [@marcosgriselli](https://twitter.com/marcosgriselli)\n\n[![Twitter Follow](https://img.shields.io/twitter/follow/marcosgriselli.svg?style=social)](https://twitter.com/marcosgriselli)\n\n[![GitHub Follow](https://img.shields.io/github/followers/marcosgriselli.svg?style=social\u0026label=Follow)](https://github.com/marcosgriselli)\n\n## 🛡 License\n\n```\nMIT License\n\nCopyright (c) 2018 Marcos Griselli\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosgriselli%2FEasyTransitions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcosgriselli%2FEasyTransitions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosgriselli%2FEasyTransitions/lists"}