{"id":18389323,"url":"https://github.com/rightpoint/shift","last_synced_at":"2025-04-07T02:34:18.904Z","repository":{"id":143418244,"uuid":"47771996","full_name":"Rightpoint/Shift","owner":"Rightpoint","description":"A library of custom iOS View Controller Animations and Interactions written in Swift.","archived":false,"fork":false,"pushed_at":"2016-01-14T18:11:41.000Z","size":435,"stargazers_count":22,"open_issues_count":4,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-22T11:43:20.530Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rightpoint.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":"2015-12-10T15:56:45.000Z","updated_at":"2019-10-09T07:46:34.000Z","dependencies_parsed_at":"2023-04-17T02:27:10.769Z","dependency_job_id":null,"html_url":"https://github.com/Rightpoint/Shift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FShift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FShift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FShift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FShift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rightpoint","download_url":"https://codeload.github.com/Rightpoint/Shift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583331,"owners_count":20962021,"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-06T01:42:37.185Z","updated_at":"2025-04-07T02:34:13.897Z","avatar_url":"https://github.com/Rightpoint.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shift\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Shift.svg)](https://github.com/CocoaPods/CocoaPods)\n\nA library of custom iOS View Controller Animations and Interactions written in Swift.\n\n## Installation with Carthage\n\nCarthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with Homebrew using the following commands:\n\n```sh\nbrew update\nbrew install carthage\n```\n\nTo integrate Shift into your Xcode project using Carthage, specify it in your Cartfile:\n\n`github \"raizlabs/shift\"`\n\n## Installation with CocoaPods\n\nCocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.\n\nTo integrate Shift into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'Shift'\n```\n\n## Usage\n\nFirst, make sure you import the Shift module: `import Shift`.\n\nThe rest is easy. If you are pushing a view controller to the navigation stack, follow these three steps:\n\n- Set your navigation controller's delegate :\n\n```swift\nnavigationController?.delegate = self\n```\n- Store the transition on your view controller:\n\n```swift\nvar currentTransition: UIViewControllerAnimatedTransitioning?\n```\n\n- Extend your view controller to implement `UINavigationControllerDelegateTransitioning`. In your implementation, make sure to set the `currentTransition`:\n\n```swift\nextension ViewController: UINavigationControllerDelegate {\n\n    func navigationController(navigationController: UINavigationController,\n        animationControllerForOperation operation: UINavigationControllerOperation,\n        fromViewController fromVC: UIViewController,\n        toViewController toVC: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n\n        if (operation == .Push \u0026\u0026 fromVC == self) {\n            /*\n             * set currentTransition here\n             */\n        }\n        else if (operation == .Pop \u0026\u0026 toVC == self) {\n        }\n\n        return currentTransition\n    }\n}\n\n```\n\n### SplitTransition (Push/Pop)\n\n\u003cp align=\"center\" \u003e\n\u003cbr/\u003e\n\u003cimg src=\"https://raw.github.com/raizlabs/shift/master/SplitTransition.gif\" alt=\"Overview\" /\u003e\n\u003cbr/\u003e\n\u003c/p\u003e\n\n`SplitTransition` exposes 5 key properties:\n\n1. `screenshotScope` - (optional, defaults to `.View`) - determines whether top and bottom views are sourced from container view or entire window\n2. `splitLocation` (optional, defaults to `0.0`) - y coordinate where the top and bottom views part\n3. `transitionDuration` (optional, defaults to `1.0`) - duration (in seconds) of the transition animation \n4. `transitionDelay` (optional, defaults to `0.0`) - delay (in seconds) before the start of the transition animation\n5. `transitionType` (optional, defaults to `.Push`) - `.Push`, `.Pop`, or `.Interactive`. Setting `transitionType` to `.Interactive` will allow users to control the progress of the transition with a drag gesture.\n\nSet these properties in your implementation of\t`UINavigationControllerDelegateTransitioning`:\n\n```swift\nfunc navigationController(navigationController: UINavigationController,\n    animationControllerForOperation operation: UINavigationControllerOperation,\n    fromViewController fromVC: UIViewController,\n    toViewController toVC: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n\n    if (operation == .Push \u0026\u0026 fromVC == self) {\n        let splitTransition = SplitTransitionController()\n        splitTransition.transitionDuration = 2.0\n        splitTransition.transitionType = .Push\n        splitTransition.splitLocation = currentCell != nil ? CGRectGetMidY(currentCell!.frame) : CGRectGetMidY(view.frame)\n        currentTransition = splitTransition\n    }\n    else if (operation == .Pop \u0026\u0026 toVC == self) {\n        currentTransition?.transitionType = .Pop\n    }\n\n    return currentTransition\n}\n```\n\n### SplitTransition (Present/Dismiss)\n\nUsing `SplitTransition` to present a view controller modally is simple. For the presented view controller, set `modalPresentationStyle` to `.Custom`. For the `SplitTransition`, set `transitionType` to `.Presentation`, passing a presenting view controller and a presented view controller into the constructor. In addition, set your presented view controller's `transitioningDelegate` to the newly created `SplitTransition`.\n\n```swift\n// Configure destination view controller\nlet destinationViewController = UIViewController()\ndestinationViewController.modalPresentationStyle = .Custom\n\n// Configure transition\nlet currentTransition = SplitTransition()\ncurrentTransition?.transitionType = .Presentation(self, destinationViewController)\n\n// Set transitioning delegate on destination view controller\ndestinationViewController.transitioningDelegate = currentTransition\n```\n\nLastly, in `presentViewController`'s completion handler set `transitionType` to `.Dismiss`, again passing in a presented view controller and a presenting view controller:\n\n```swift\npresentViewController(destinationViewController, animated: true) { [weak self] () -\u003e Void in\n    guard let vc = self,\n    presentedVC = self?.presentedViewController else {\n        debugPrint(\"SplitTransitionAnimatedPresentDismissViewControllerViewController has been deallocated\")\n        return\n    }\n\n    // After presentation has finished, update transitionType on currentTransition\n    vc.currentTransition?.transitionType = .Dismissal(presentedVC, vc)\n}\n```\n\n### ZoomPushTransition\n\n\u003cp align=\"center\" \u003e\n\u003cbr/\u003e\n\u003cimg src=\"ZoomPushTransition.gif\" alt=\"Overview\" /\u003e\n\u003cbr/\u003e\n\u003c/p\u003e\n\n`ZoomPushTransition` exposes 2 key properties:\n\n1. `transitionTime` - duration (in seconds) of the transition\n2. `scaleChangePct` - a transform which scales the destination view controller's view by `(sx, sy)' at the start of the transition\n\nSet these properties in your view controller's implementation of\t`UINavigationControllerDelegate`:\n\n\n```swift\n    func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n        let zoomPushTransition = ZoomPushTransition()\n        zoomPushTransition.transitionTime = 0.35\n        zoomPushTransition.scaleChangePct = 0.33\n        return zoomPushTransition\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Fshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frightpoint%2Fshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Fshift/lists"}