{"id":2383,"url":"https://github.com/DianQK/TransitionTreasury","last_synced_at":"2025-08-02T23:33:16.534Z","repository":{"id":56924514,"uuid":"48093563","full_name":"DianQK/TransitionTreasury","owner":"DianQK","description":"Easier way to push your viewController.","archived":true,"fork":false,"pushed_at":"2019-08-26T14:32:33.000Z","size":16755,"stargazers_count":2092,"open_issues_count":22,"forks_count":158,"subscribers_count":48,"default_branch":"master","last_synced_at":"2024-04-24T14:48:06.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://transitiontreasury.com","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/DianQK.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-12-16T07:03:42.000Z","updated_at":"2024-04-19T01:37:41.000Z","dependencies_parsed_at":"2022-08-20T22:10:06.831Z","dependency_job_id":null,"html_url":"https://github.com/DianQK/TransitionTreasury","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DianQK%2FTransitionTreasury","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DianQK%2FTransitionTreasury/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DianQK%2FTransitionTreasury/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DianQK%2FTransitionTreasury/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DianQK","download_url":"https://codeload.github.com/DianQK/TransitionTreasury/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.423Z","updated_at":"2024-12-06T17:31:02.152Z","avatar_url":"https://github.com/DianQK.png","language":"Swift","funding_links":[],"categories":["UI","Swift"],"sub_categories":["Transition","Layout","Other free courses"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/DianQK/TransitionTreasury/master/transitiontreasury.png\" alt=\"TransitionTreasury\" title=\"TransitionTreasury\" width=\"1000\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/DianQK/TransitionTreasury\"\u003e\u003cimg src=\"https://travis-ci.org/DianQK/TransitionTreasury.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://img.shields.io/cocoapods/v/TransitionTreasury.svg\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/TransitionTreasury.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://cocoadocs.org/docsets/TransitionTreasury\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/p/TransitionTreasury.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://raw.githubusercontent.com/DianQK/TransitionTreasury/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://twitter.com/Songxut\"\u003e\u003cimg src=\"https://img.shields.io/badge/twitter-@Songxut-blue.svg?style=flat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nTransitionTreasury is a viewController transition framework in Swift.      \n\n\u003cp align=\"center\"\u003e\n\u003ch1\u003eYou can see https://transitiontreasury.com\u003c/h1\u003e\n\u003c/p\u003e\n\n## Features    \n\n* [x] Push \u0026 Present \u0026 TabBar transition animation\n* [x] Easy create transition \u0026 extension\n* [x] Support completion callback\n* [x] Support modal viewController data callback\n* [x] Support Custom Transition\n* [x] Support Update Status Bar Style\n* [x] Support Push \u0026 Present \u0026 TabBar Gesture.\n* [x] [Complete Documentation](https://github.com/DianQK/TransitionTreasury/tree/master/Documentation)\n\n## Migration Guides\n\n* [TransitionTreasury 3.0 Migration Guide](https://github.com/DianQK/TransitionTreasury/blob/master/Documentation/TransitionTreasury 3.0 Migration Guide.md)\n\n## Requirements   \n\n* iOS 8.0+\n* Xcode 10.0+\n\n## Communication\n\n* If you **need help or found a bug**, open an issue.\n* If you **have a new transition animation** or *want to contribute*, submit a pull request. :]\n\n## Installation\n\n### CocoaPods    \n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate TransitionTreasury into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nuse_frameworks!\npod 'TransitionTreasury', '~\u003e 7.0'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\nIn any file you'd like to use TransitionTreasury in, don't forget to import the framework with import TransitionTreasury.\n\nFor TransitionAnimation extensions, this project will include them as dependencies. You can do this via CocoaPods subspecs.\n\n```ruby\npod 'TransitionAnimation', '~\u003e 7.0'\n```\n\n\u003cs\u003e### Carthage    \n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use [Homebrew](https://brew.sh).\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate TransitionTreasury into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```\ngithub \"DianQK/TransitionTreasury\"\n```\n\nThen, run the following command to build the TransitionTreasury framework:\n\n```bash\n$ carthage update\n```\n\nAt last, you need to set up your Xcode project manually to add the TransitionTreasury framework.\n\nOn your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.\n\nOn your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:\n\n```bash\n/usr/local/bin/carthage copy-frameworks\n```\n\nand add the paths to the frameworks you want to use under “Input Files”:\n\n```bash\n$(SRCROOT)/Carthage/Build/iOS/TransitionTreasury.framework\n$(SRCROOT)/Carthage/Build/iOS/TransitionAnimation.framework // If need\n```\n\nFor more information about how to use Carthage, please see its [project page](https://github.com/Carthage/Carthage).\u003c/s\u003e\n\n## Usage   \n\n\u003e You can check out [Example](https://github.com/DianQK/TransitionTreasury/tree/master/Example) or [Demo](https://github.com/DianQK/TransitionTreasury/tree/master/Demo) .  \n\u003e Don't forget `pod install` for [Example](https://github.com/DianQK/TransitionTreasury/tree/master/Example) .    \n\n### Make a Push   \n\nIf we need to push `FirstViewController` to `SecondViewController`, `SecondViewController` should conform `NavgationTransitionable`, and add code `var tr_pushTransition: TRNavgationTransitionDelegate?`, I need use this property to retain animation object. Of course, you can use this do more, but it is dangerous.   \n\nWhen you need to push, just call `public func tr_pushViewController\u003cT : UIViewController where T : NavgationTransitionable\u003e(viewController: T, method: TransitionAnimationable, statusBarStyle: TransitionTreasury.TRStatusBarStyle = default, completion: (() -\u003e Void)? = default)`, like Apple method. About `method` parameter, see [transitiontreasury.com](https://transitiontreasury.com).\n\nExample：   \n\n```swift\n/// FirstViewController.swift\nclass FirstViewController: UIViewController {\n\n    func push() {\n        let vc = SecondViewController()\n        navigationController?.tr_pushViewController(vc, method: TRPushTransitionMethod.fade, completion: {\n                print(\"Push finish\")\n            })\n    }\n}\n\n/// SecondViewController.swift\nclass SecondViewController: UIViewController, NavgationTransitionable {\n\n    var tr_pushTransition: TRNavgationTransitionDelegate?\n\n    func pop() {\n        tr_popViewController()\n    }\n}\n```    \n\nWhen you need to pop, just call `public func tr_popViewController(completion: (() -\u003e Void)? = nil) -\u003e UIViewController?`.\n\n### Make a Present   \n\nIf we present `MainViewController` to `ModalViewController`:     \n\n* `MainViewController` should conform `ModalTransitionDelegate`, and add `var tr_presentTransition: TRViewControllerTransitionDelegate?`\n* Add `weak var modalDelegate: ModalViewControllerDelegate?` for `ModalViewController`.\n\nExample：       \n\n```Swift\n/// MainViewController.swift\nclass MainViewController: UIViewController, ModalTransitionDelegate {\n\n    var tr_presentTransition: TRViewControllerTransitionDelegate?\n\n    func present() {\n        let vc = ModalViewController()\n        vc.modalDelegate = self // Don't forget to set modalDelegate\n        tr_presentViewController(vc, method: TRPresentTransitionMethod.Fade, completion: {\n                print(\"Present finished.\")\n            })\n    }\n}\n\n/// ModalViewController.swift\nclass ModalViewController: UIViewController {\n\n    weak var modalDelegate: ModalViewControllerDelegate?\n\n    func dismiss() {\n        modalDelegate?.modalViewControllerDismiss(callbackData: nil)\n    }\n}\n```\n\nif you need `callbackData` , your `MianViewController` should implement :\n\n```swift\nfunc modalViewControllerDismiss(interactive interactive: Bool, callbackData data:AnyObject?)\n\n// or\n\nfunc modalViewControllerDismiss(callbackData data:AnyObject?)\n```\n\n`interactive` just for interactive dismiss, for more see Advanced Usage.\n\n\u003e Note:      \n\u003e If you don't need callbackData, maybe you haven't implemented `func modalViewControllerDismiss(callbackData data:AnyObject?)`.\n\u003e If you don't want to use `ModalTransitionDelegate`, you can use `ViewControllerTransitionable` which only for Animation.\n\u003e Warning:    \n\u003e You shouldn't use `tr_dismissViewController()` in your **ModalViewController**. Please use `delegate`. I have implented this, just use `modalDelegate?.modalViewControllerDismiss(callbackData: [\"data\":\"back\"])`. For more, you can read [Dismissing a Presented View Controller](https://stackoverflow.com/questions/14636891/dismissing-a-presented-view-controller).\n\n## Advanced Usage\n\n### Create Your Transition Enum (Recommended!!!!)\n\nMaybe like this:\n\n```swift\nenum DemoTransition {\n    case FadePush\n    case TwitterPresent\n    case SlideTabBar\n}\n\nextension DemoTransition: TransitionAnimationable {\n    func transitionAnimation() -\u003e TRViewControllerAnimatedTransitioning {\n        switch self {\n        case .FadePush:\n            return FadeTransitionAnimation()\n        case .TwitterPresent :\n            return TwitterTransitionAnimation()\n        case .SlideTabBar :\n            return SlideTransitionAnimation()\n        }\n    }\n}\n```\n\nThen you can use your transition, maybe like this:\n\n```Swift\ntr_pushViewController(viewController: viewController, method: DemoTransition.FadePush)\ntr_presentViewController(viewControllerToPresent: viewController, method: DemoTransition.TwitterPresent)\n```\n\nWell, you can create your own animation, see **Custom Animation**.\n\n### Custom Animation   \n\nJust conform to `TRViewControllerAnimatedTransitioning`. If you need interactive functionality, conform to `TransitionInteractiveable`.\n\nAbout writing your own animation, you can read [Animation-Guide](https://github.com/DianQK/TransitionTreasury/wiki/Animation-Guide), I would be happy if you would share your animation for this project.\nAlso, check out `TransitionTreasury/TransitionAnimation`, there are some Animations there. You can write follow this.  \n\n### Status Bar Style     \n\nIf you want to update the status bar style, you should add the key `View controller-based status bar appearance` in your **info.plist**, and set its value to `false`.   \n\nThen, like in **Basic Usage**, just add param `statusBarStyle`:       \n\n```swift\n// Push \u0026 Pop\ntr_pushViewController(viewController: UIViewController, method: TRPushTransitionMethod.fade, statusBarStyle: UIStatusBarStyle = .Default)    \n\n// Present \u0026 Dismiss\ntr_presentViewController(viewControllerToPresent: UIViewController, method: TRPresentTransitionMethod.Fade, statusBarStyle: UIStatusBarStyle = .Default)\n```    \n\n### Interactive Transition Animation\n\nSee TransitionTreasuryDemo Scheme:   \n\n```swift\nfunc interactiveTransition(sender: UIPanGestureRecognizer) {\n        switch sender.state {\n        case .Began :\n            guard sender.translationInView(view).y \u003e 0 else {\n                break\n            }\n            let vc = UIStoryboard(name: \"Main\", bundle: nil).instantiateViewControllerWithIdentifier(\"ModalViewController\") as! ModalViewController\n            vc.modalDelegate = self\n            tr_presentViewController(vc, method: TRPresentTransitionMethod.Scanbot(present: sender, dismiss: vc.dismissGestureRecognizer), completion: {\n                print(\"Present finished\")\n            })\n        default : break\n        }\n    }\n```\n\u003e Warning:\n\u003e Make sure you just call `tr_presentViewController(_:_:_:)` once.\n\n### TabBar Transition Animation\n\nJust add this code:\n\n```swift\ntabBarController.tr_transitionDelegate = TRTabBarTransitionDelegate(method: TRTabBarTransitionDelegate.Slide)\n```\n\n\u003e Note:\n\u003e If you need `delegate`, please use `tr_delegate`.\n\nYou can see `Demo/TabBarDemo`.\n\n## License\n\nTransitionTreasury is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDianQK%2FTransitionTreasury","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDianQK%2FTransitionTreasury","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDianQK%2FTransitionTreasury/lists"}