Skip to content

Instantly share code, notes, and snippets.

@mingsai
Created February 12, 2016 18:13
Show Gist options
  • Select an option

  • Save mingsai/6a62b245f577a83dae33 to your computer and use it in GitHub Desktop.

Select an option

Save mingsai/6a62b245f577a83dae33 to your computer and use it in GitHub Desktop.
A set of Swift classes to disable the automatic animation associated with a segue. One can then add one's custom animation instead.
//
// ModalNoAnimationSegue.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 9/2/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
/// Present the next screen without an animation.
class ModalNoAnimationSegue: UIStoryboardSegue {
override func perform() {
self.sourceViewController.presentViewController(
self.destinationViewController as UIViewController,
animated: false,
completion: nil)
}
}
//
// PushNoAnimationSegue.swift
//
//
// Created by Tommie N. Carter, Jr., MBA on 9/2/15.
// Copyright © 2015 MING Technology. All rights reserved.
//
import UIKit
/// Move to the next screen without an animation.
class PushNoAnimationSegue: UIStoryboardSegue {
override func perform() {
let source = sourceViewController as UIViewController
if let navigation = source.navigationController {
navigation.pushViewController(destinationViewController as UIViewController, animated: false)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment