GithubHelp home page GithubHelp logo

touchwonders / transition Goto Github PK

View Code? Open in Web Editor NEW
2.6K 45.0 126.0 11.45 MB

Easy interactive interruptible custom ViewController transitions

License: MIT License

Ruby 0.68% Swift 98.46% Objective-C 0.86%
swift ios viewcontroller transitions view controller transition animation interactive interuptable

transition's People

Contributors

basthomas avatar chrisikern avatar colorbox avatar kdvmgn avatar murilxaraujo avatar mvolpato avatar roberthein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transition's Issues

iPhone X Safe Margins

After clicking on a cell, the expansion animation seems like it's not taking the safety margins into account.

Before Autolayout Breaks Constraints

simulator screen shot - iphone x - 2018-10-14 at 22 12 54

After Autolayout Breaks Constraints

simulator screen shot - iphone x - 2018-10-14 at 22 12 58

Here is the error log for your reference :D

2018-10-14 22:11:19.430659-0500 Transition_Example[48438:2420401] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600002cb21c0 Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 399.967   (active)>",
    "<NSLayoutConstraint:0x600002cb2580 'UIView-Encapsulated-Layout-Height' Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 400   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600002cb2580 'UIView-Encapsulated-Layout-Height' Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 400   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2018-10-14 22:11:19.488227-0500 Transition_Example[48438:2420401] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600002cb21c0 Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 399.967   (active)>",
    "<NSLayoutConstraint:0x600002cb2580 'UIView-Encapsulated-Layout-Height' Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 400   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600002cb2580 'UIView-Encapsulated-Layout-Height' Transition_Example.CollectionViewCell:0x7fd929c67b50.height == 400   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Pinterest example

Hi,
where can I find the demo project with the pinterest transition?
In the readme there is the gif, but I didn't found it in the example directory.

Interactive Modal using Pan crashes on Dismiss

Hi,

Great library. I'm trying to do a simple interactive modal transition. I'm using PanInteractionController(forModalTransitionsAtEdge...) and the TransitionController(forInteractiveModalPresentationsFrom...) to setup the interactionController and transitionController. Presenting works fine.

When I try to dismiss the view by flicking upwards, I get "fatal error: unexpectedly found nil while unwrapping an Optional value" in "UIViewControllerContextTransitioning+Properties.swift". Basically "toView" is nil here:

case .dismiss: if toView.superview == nil { containerView.insertSubview(toView, belowSubview: fromView) }

Is this an issue, or am I not setting up the transition controller correctly.

Thanks.
Jan-Michael

PS: Here's the code to produce the issue. The StickerViewController is just a view with a UILabel.

import UIKit
import Transition

class ViewController: UIViewController
{
private(set) var transitionController: TransitionController!
private(set) var interactionController: PanInteractionController!

fileprivate weak var stickerViewController: StickerViewController?

override func viewDidLoad()
{
    super.viewDidLoad()
    self.view.backgroundColor = UIColor.red
}

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    
    if interactionController == nil
    {
        self.interactionController = PanInteractionController(forModalTransitionsAtEdge: .top)
        self.transitionController = TransitionController(forInteractiveModalPresentationsFrom: self, transitionsSource: self, interactionController: interactionController)
    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

extension ViewController : TransitionsSource
{
// proivide transition for presentation / dismissal
func transitionFor(operationContext: TransitionOperationContext, interactionController: TransitionInteractionController?) -> Transition
{
//animation
let transitionAnimation = MoveTransitionAnimation(forModalTransitionsAtEdge: .top)
let transition = Transition(duration: 0.4, animation: transitionAnimation)
return transition
}
}

extension ViewController : InteractiveModalTransitionOperationDelegate
{
func viewControllerForInteractiveModalPresentation(by sourceViewController: UIViewController, gestureRecognizer: UIGestureRecognizer) -> UIViewController
{
let vc = self.storyboard?.instantiateViewController(withIdentifier: "sticker")
vc?.modalPresentationStyle = .overCurrentContext
vc?.transitioningDelegate = self as? UIViewControllerTransitioningDelegate

    self.stickerViewController = vc as? StickerViewController
    return vc!
}

}

Swift 4.2

This project uses many methods deprecated in Swift 4.2. Right now, it is possible to build it with Swift 4.0 and include it in a project build with Swift 4.2. However, it would be nice to have an update to the project itself to work with Swift 4.2.

Swift 4

Hi,

Any news on moving officially to 4+ ?

Regards,
H.

Flick to dismiss causes animations to break

Flicking to dismiss view controllers breaks the animations. You can get stuck between two states. I was able to repro using Modal Transition example and Pinterest example easily.

  • Modal Example: Flick the icon up; notice animation is stuck.
  • Pinterest Example: Dismiss a view controller by flicking down. Again animation gets stuck.
  • I can provide video if you are not able to repro it. Other than this issue; it looks great; Awesome job by the team! keep it up!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.