{"id":13908533,"url":"https://github.com/malcommac/UIWindowTransitions","last_synced_at":"2025-07-18T07:31:35.363Z","repository":{"id":56307570,"uuid":"108954678","full_name":"malcommac/UIWindowTransitions","owner":"malcommac","description":"🏃‍♂️ Animated transitions for UIWindow's rootViewController property","archived":false,"fork":false,"pushed_at":"2020-11-15T17:34:51.000Z","size":4363,"stargazers_count":473,"open_issues_count":0,"forks_count":34,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-26T06:02:41.124Z","etag":null,"topics":["rootviewcontroller","uikit","uiwindow"],"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/malcommac.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":"2017-10-31T06:27:41.000Z","updated_at":"2025-05-25T18:35:56.000Z","dependencies_parsed_at":"2022-08-15T16:20:51.472Z","dependency_job_id":null,"html_url":"https://github.com/malcommac/UIWindowTransitions","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/malcommac/UIWindowTransitions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcommac%2FUIWindowTransitions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcommac%2FUIWindowTransitions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcommac%2FUIWindowTransitions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcommac%2FUIWindowTransitions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malcommac","download_url":"https://codeload.github.com/malcommac/UIWindowTransitions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcommac%2FUIWindowTransitions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265720592,"owners_count":23817267,"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":["rootviewcontroller","uikit","uiwindow"],"created_at":"2024-08-06T23:02:48.030Z","updated_at":"2025-07-18T07:31:33.648Z","avatar_url":"https://github.com/malcommac.png","language":"Swift","readme":"\u003cp align=\"center\" \u003e\n  \u003cimg src=\"banner.png\" width=300px alt=\"UIWindowTransitions\" title=\"UIWindowTransitions\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003eAnimate UIWindow's rootViewController transitions\u003c/strong\u003e\u003c/p\u003e\n\nThis is a small project used to demostrate how to implement UIWindow's `rootViewController` transitions with a little piece of code.\nYou can found the original article for [this article here](http://danielemargutti.com/animate-uiwindows-rootviewcontroller-transitions).\n\n## Motivation\n\nSometimes during the lifecycle of an application you may need to change the `rootViewController`  of your main `UIWindow` ; a typical case maybe the transition between the initial on-boarding and the home of the app (ie. a `UITabBarController` ).\n\nIn order to handle this edge case you may want to create a top controller (typically an `UINavigationController` with invisible navigation bar) which enable you to push your new container using a standard push animation.\n\nWhile basically it works fine, the addition of a container used only to handle this single operation is a bit awful to see.\n\nA way better solution is to apply an animated transition (push/pop or slide) to the `rootViewController` set so you will get an animate switch from the current view controller to the new one.\n\nIn fact, even if not exposed, you can and its really simple to accomplish via `CoreAnimation` and `CATransition` .\n\nThe following code implements a new function as extension of `UIWindow` class; it takes two arguments: the destination controller and options.\n\nAs you may imagine the destination controller is the controller you want to set as new `rootViewController`, while options is struct used to group some typical CoreAnimation settings: the animation direction (pop/push/slide from top or bottom), the animation curve (linear, ease in/out), the duration of the animation (by default is 0.25s) and an optional UIView instance used to fade in/out between the old and new view.\n\n## Known Issue \u0026 Fix\n\nThe 1.0.0 fixes and issue with iOS currently opened as [radar here](http://www.openradar.me/21404408). This fix was created by voltbank in his repository [ReplaceRootViewController](https://github.com/voltbank/ReplaceRootViewController) forked from this project.\n\n## ❤️ Your Support\n\n*Hi fellow developer!*  \nYou know, maintaing and developing tools consumes resources and time. While I enjoy making them **your support is foundamental to allow me continue its development**.  \n\nIf you are using SwiftLocation or any other of my creations please consider the following options:\n\n- [**Make a donation with PayPal**](https://www.paypal.com/paypalme/danielemargutti/20)\n- [**Become a Sponsor**](https://github.com/sponsors/malcommac)\n\n- [Follow Me](https://github.com/malcommac)\n- \n## How to use it\n\nOnce implemented you can use the only function exposed to all UIWindow instances called\n```swift\nfunc set(rootViewController newRootViewController: UIViewController, options: TransitionOptions = TransitionOptions(), _ completion:((Bool) -\u003e Void)? = nil)\n```\n\nwhere:\n\n* `controller`: the destination view controller to set as new `rootViewController`\n* `options`: a `TransitionOptions` with the following properties:\n\t* `duration`: duration of the animation (expressed in `TimeInterval`, seconds, default is `0.25`)\n\t* `direction`: direction of the transition (`toRight`,`toLeft`,`toTop`,`toBottom`, default is `.toRight`)\n\t* `style`: animation curve (`linear`,`easeIn`,`easeOut`,`easeInOut`, default is `.linear`)\n\t* `background`: background view set for fade in-out into the old/new controller (by default is `nil`).\n* `completion`: completion callback to receive info when transition did completes.\n\nThe following code change the ``rootViewController`` using a ease out - slide up animation of 0.4 seconds.\n\n```swift\nlet wnd = UIApplication.shared.keyWindow\nvar options = UIWindow.TransitionOptions()\noptions.direction = .toTop\noptions.duration = 0.4\noptions.style = .easeOut\nwnd?.set(rootViewController(newVC, options: options)\n```\n\nIf you just need of a simple push (like `UINavigationController`'s push) you can call it without the `options` arg:\n\n```swift\nwnd?.set(rootViewController(newVC)\n```\n\n## Demo App\n\nThe following demo is available inside the project's demo application.\n\n![](https://github.com/malcommac/UIWindowTransitions/blob/master/UIWindowTransitions_Demo_Animation.gif)\n\n## Installation\nYou can install UIWindowTransitions using CocoaPods, Carthage and Swift package manager\n\n`pod 'UIWindowTransitions'`\n\n### CocoaPods\n\n```ruby\nuse_frameworks!\npod 'UIWindowTransitions'\n```\n\n### Swift Package Manager\nAdd UIWindowTransitions as dependency in your `Package.swift`\n\n```swift\nimport PackageDescription\n\nlet package = Package(name: \"YourPackage\",\n\tdependencies: [\n\t\t.Package(url: \"https://github.com/malcommac/UIWindowTransitions.git\", majorVersion: 0),\n\t]\n)\n```\n\n## Contributing\n\n- If you **need help** or you'd like to **ask a general question**, open an issue.\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n## Copyright \u0026 Acknowledgements\n\nUIWindowTransitions is currently owned and maintained by Daniele Margutti.  \nYou can follow me on Twitter [@danielemargutti](http://twitter.com/danielemargutti).  \nMy web site is [https://www.danielemargutti.com](https://www.danielemargutti.com) \n\nThis software is licensed under [MIT License](LICENSE.md).\n\n***Follow me on:***  \n- 💼 [Linkedin](https://www.linkedin.com/in/danielemargutti/)  \n- 🐦 [Twitter](https://twitter.com/danielemargutti)","funding_links":["https://www.paypal.com/paypalme/danielemargutti/20","https://github.com/sponsors/malcommac"],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcommac%2FUIWindowTransitions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalcommac%2FUIWindowTransitions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcommac%2FUIWindowTransitions/lists"}