Reputation: 904
So... Truth is, I've been navigating through the documentation almost blindly. I really don't understand why there's no sample code illustrating how to use certain methods. But yeah, enough whining from me.
I have a view controller that conforms to UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning. I have a few animations (using facebook pop) that essentially slide certain elements of the view out. After these animations complete I want to transition to the next view controller.
I have overridden prepareForSegue like so:
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
self.transitioningDelegate = self;
let targetViewController = self.storyboard.instantiateViewControllerWithIdentifier("chooseSigilViewController") as UIViewController;
self.presentViewController(targetViewController, animated: true, completion: nil);
// slide out ui elements in the current UIViewController
slideLabelsOut(greetingsLabel, nameUtilityLabel);
slideTextFieldOut(inputPlayerNameTextField);
slideProceedButtonOut(sender as UIButton); }
I than set up the transition duration and the actual animation... what I have problem with is this line:
UIView.animateWithDuration(self.transitionDuration(transitionContext), animations: <#(() -> Void)?#>, completion: <#((Bool) -> Void)?#>)
How do I setup my code within the animations: and completion: arguments.
I've seen this used in Obj-C code:
^{ // code goes here }
I've tried it that way, it didn't work. Also it felt really awkward as I don't really know what that "^" even does?
Upvotes: 3
Views: 2011
Reputation:
Try something like this:
UIView.animateWithDuration(self.transitionDuration(transitionContext), delay: 0, options: .CurveLinear, animations: {
// Your animation
}, completion: {
(finished: Bool) in
// Your completion
})
Upvotes: 3