phimage / CustomSegue

Custom segue for OSX Storyboards with slide and cross fade effects (NSViewControllerTransitionOptions)
MIT License
122 stars 12 forks source link

How to use Programmatically #1

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hello this is really cool to used , thanks and Really appreciated it is easy to use in IBInspector but how can i used it programmtically ?

phimage commented 8 years ago

I am not aware of method to use segue without storyboard

But I think you can use the NSViewControllerPresentationAnimator to present a view There is TransitionAnimator class for instance

parentController.presentViewController(viewController, animator: animator)

or with my extensions if you have already set the parent controller

viewController.present(.animator(animator: animator)) // I think I will remove argument name ,too much animator word
ghost commented 8 years ago

I am not aware of method to use segue without storyboard

same here , looking for here and there but no answer till now

for instance i used

self.presentViewController(sourceViewController, animator: TransitionAnimator() as NSViewControllerPresentationAnimator)

it doing sheetway but i need slidefromleft how i can achieve this ?

thankss

phimage commented 8 years ago

Customize TransitionAnimator

let animator = TransitionAnimator()
animator.transition = [.slideLeft, .crossfade]
// animator.duration = ...
ghost commented 8 years ago

yeah , meanwhile i customized it

i use only slideleft
Thank you very much :)