[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7101":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":37,"discoverSource":38},7101,"Transition","Touchwonders\u002FTransition","Touchwonders","Easy interactive interruptible custom ViewController transitions",null,"Swift",2628,127,40,2,0,1,58.42,"MIT License",false,"master",true,[23,24,25,26,27,28,29,30,31,32,33],"animation","controller","custom","interactive","interuptable","ios","swift","transition","transitions","view","viewcontroller","2026-06-12 04:00:32","\u003Cdiv align=\"center\">\n    \u003Cimg src=\"Documentation\u002Fartwork\u002Fheader.png\" width=\"890\" alt=\"Transition\"\u002F>\n\u003C\u002Fdiv>\n\n[![CocoaPods version](https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fv\u002FTransition.svg)](https:\u002F\u002Fcocoapods.org\u002Fpods\u002FTransition) [![Carthage compatible](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCarthage-compatible-4BC51D.svg?style=flat)](https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage) [![license](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FTouchwonders\u002Ftransition.svg)](https:\u002F\u002Fgithub.com\u002FTouchwonders\u002FTransition\u002Fblob\u002Fmaster\u002FLICENSE) [![platform](https:\u002F\u002Fcocoapod-badges.herokuapp.com\u002Fp\u002FTransition\u002Fbadge.png)]()\n\n\n## Introduction\n**Transition** is a library that helps you build iOS view controller transitions. \nImplementing a nice interactive custom view controller transition involves quite a number of components. You have to implement the correct delegates, handle the switching between passive animation and active interaction phases, ensure the timing is right, think of interruption and cancellation, keep responsibilities separated... It quickly gets messy! This is where Transition helps you out: you just define the animation and the interaction, Transition ties it all together.\n\n**In short:**\n\n* You specify single-responsibility components (animation, interaction, ...)\n* Transition ties them together\n\n## Examples\n\nThere are several examples (which can be found in `Examples\u002F`):\n\n1. **SimpleExample**: implements the basic steps explained in this README.\n2. **TabBarTransitionsExample**: shows you how to implement custom `UITabBarController` transition animations with custom interaction.\n3. **ModalTransitionsExample**: shows you how to implement custom *modal* transition animations that include interaction with a **shared element**.\n4. **BuiltInTransitionsCatalog**: shows a small collection of built-in transition animations.\n\nTo run an example project, clone the repo, navigate to one of these example directories, and run `pod install` from that directory first.\n\n---\n\n![](Documentation\u002Fartwork\u002Ftabbar.gif)![](Documentation\u002Fartwork\u002Fmodal.gif)![](Documentation\u002Fartwork\u002Fnavigation.gif)\n\n---\n\n## Requirements\n\n* iOS 10.0+\n* Swift 3.0+\n\n## Usage\n\n### 1. The AnimationLayer\n\nThe `AnimationLayer` is the most essential part of setting up a transition; without it, there'll be no animation. An `AnimationLayer` is a simple struct that takes two arguments:\n\n##### 1. Animation function\nThis is a simple closure with the signature `() -> Void`. In this closure you define your animation, just as you would with a `UIView` or `UIViewPropertyAnimator` animation. For each `AnimationLayer`, Transition will instantiate a `UIViewPropertyAnimator`, passing it your animation block.\n\n##### 2. TimingParameters\n\nThis defines the timing of your animation. It must be a `UITimingCurveProvider`, such as an instance of `UICubicTimingParameters` or `UISpringTimingParameters`.\n\n##### _(3. AnimationRange)_\nAdditionally, you can set an `AnimationRange`, which by default is set to `AnimationRange.full`. This range defines the start and end point (as fractions of the total transition animation duration) between which your `AnimationLayer`'s animation will run.\n\nYou create your `AnimationLayer` as follows:\n\n```swift\nlet animationLayer = AnimationLayer(timingParameters: UICubicTimingParameters(animationCurve: .easeOut)\n                                           animation: { topView?.transform = targetTransform })\n```\n\n**😦 ... Hey, wait! Where do that `topView` and `targetTransform` come from?**\n\n### 2. The TransitionAnimation\n\nYour `AnimationLayer` is defined as a part of your `TransitionAnimation`. This represents all (non-interactive) animation during a transition. The `TransitionAnimation` protocol exposes an array of `AnimationLayers`. Additionally it contains two functions; one for setup and one for completion. Before starting animation, your setup function will be called, passing you the transitioningContext that among others contains the `fromView` and `toView` in the transition. The completion function is called when the entire transition completes, allowing you to clean up any temporary views added in the setup.\n\n```swift\nclass SimpleAnimation : TransitionAnimation {\n    \n    private weak var topView: UIView?\n    private var targetTransform: CGAffineTransform = .identity\n    \n    func setup(in operationContext: TransitionOperationContext) {\n        let context = operationContext.context\n        let isPresenting = operationContext.operation.isPresenting\n        \n        \u002F\u002F  We have to add the toView to the transitionContext, at the appropriate index:\n        if isPresenting {\n            context.containerView.addSubview(context.toView)\n        } else {\n            context.containerView.insertSubview(context.toView, at: 0)\n        }\n        context.toView.frame = context.finalFrame(for: context.toViewController)\n        \n        \u002F\u002F  We only animate the view that will be on top:\n        topView = isPresenting ? context.toView : context.fromView\n        \n        let hiddenTransform = CGAffineTransform(translationX: 0, y: -context.containerView.bounds.height)\n        \n        topView?.transform = isPresenting ? hiddenTransform : .identity\n        targetTransform = isPresenting ? .identity : hiddenTransform\n    }\n    \n    var layers: [AnimationLayer] {\n        return [AnimationLayer(timingParameters: AnimationTimingParameters(animationCurve: .easeOut), animation: animate)]\n    }\n    \n    func animate() {\n        topView?.transform = targetTransform\n    }\n    \n    func completion(position: UIViewAnimatingPosition) {}\n}\n```\n\n**🤔 ... But what about duration?**\n\n### 3. The Transition\n\nYou just defined the animation of your transition. You now create a **`Transition`** struct that has an `animation` part (your `TransitionAnimation`) and an optional `sharedElement` part, which you can see implemented in the Modal and Navigation examples. And the `Transition` has a duration!\n\n```swift\nlet transition = Transition(duration: 2.0, animation: SimpleAnimation())\n```\n\n**😬 ... And where do I put that transition?**\n\n### 4. The TransitionController\n\nAlmost there. Say you want to use this transition for `UINavigationController` transitions. Let's make a convenience object that isolates transition-related functionality for a navigationController:\n\n```swift\nclass MyNavigationTransitions {\n    let transitionController: TransitionController\n    let transitionsSource = MyNavigationTransitionSource()\n    \n    init(navigationController: UINavigationController) {\n        transitionController = TransitionController(forTransitionsIn: navigationController, transitionsSource: transitionsSource)\n    }\n}\n\nclass MyNavigationTransitionSource : TransitionsSource {\n    func transitionFor(operationContext: TransitionOperationContext, interactionController: TransitionInteractionController?) -> Transition {\n        return Transition(duration: 0.5, animation: SimpleAnimation())\n    }\n}\n```\n\nThe `TransitionController` takes responsibility for animating transitions in the given navigationController, using an external `TransitionsSource` to provide operation-specific transitions (the operation – in this case push or pop – can be obtained from the `TransitionOperationContext`). This means you can return different transition animations for push and pop. You can also provide a single animation that behaves differently depending on the operation (see the `SimpleAnimation`).\n\nNow, initialize your `MyNavigationTransitions`, passing it your navigationController.\n\n**🤓 ... Is that it?**\n\nYes!\n\n😎\n\nAt least, for custom view controller transition animations. There's a lot more that'll help you set up a custom interaction gesture and a shared element that can move between the transitioning views.\n\nThe above steps are implemented in the `SimpleExample` that can be found in the `Examples\u002F` directory.\n\n## Further reading\n\n* [Adding custom interaction](Documentation\u002Fcustom_interaction.md)\n* [Adding a shared element](Documentation\u002Fshared_element.md)\n* [A note on timing](Documentation\u002Ftiming.md)\n\n## Installation\n\nTransition is available through [CocoaPods](http:\u002F\u002Fcocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Transition'\n```\n\n## Your input is welcome!\nIf you have any suggestions, please get in touch [with us](https:\u002F\u002Ftwitter.com\u002Ftouchwonders). Feel free to fork and submit pull requests. Also, we're Dutch, so if any naming is odd, might be improved or is just plain inappropriate, let us know!\n\n## Backlog\n* Add functioning `UIPresentationController` support (it's there, but it doesn't animate properly...)\n* Write more tests\n* See if nonlinear scrubbing (iOS 11, https:\u002F\u002Fdeveloper.apple.com\u002Fvideos\u002Fplay\u002Fwwdc2017\u002F230\u002F) can be added\n* ...?\n\n## License\n\nTransition is available under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","Transition 是一个用于构建 iOS 视图控制器转场动画的库。其核心功能在于简化自定义交互式视图控制器转场的实现过程，用户只需定义动画和交互的具体逻辑，Transition 会自动处理组件间的协调工作，包括动画与交互之间的切换、中断处理等复杂细节。该项目采用 Swift 语言编写，支持通过 CocoaPods 或 Carthage 集成到项目中，并且提供了多个示例来展示如何创建不同类型的转场效果，如标签栏、模态以及共享元素过渡。适用于需要为 iOS 应用添加平滑且高度可定制化界面转换效果的各种场景。","2026-06-11 03:10:32","top_language"]