This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func presentWithAnimator(sender: NSButton) { | |
let animator = MyCustomSwiftAnimator() | |
let vc = MyViewController() as NSViewController | |
self.presentViewController(vc, animator: animator) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import AppKit | |
class MyCustomSwiftAnimator: NSObject, NSViewControllerPresentationAnimator { | |
@objc func animatePresentationOfViewController(viewController: NSViewController, fromViewController: NSViewController) { | |
let bottomVC = fromViewController | |
let topVC = viewController | |
topVC.view.wantsLayer = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSAnimationContext.runAnimationGroup({ (context) -> Void in | |
var transition:CATransition = CATransition() | |
transition.duration = 0.3 | |
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) | |
transition.type = kCATransitionPush | |
transition.subtype = kCATransitionFromRight | |
transition.delegate = self | |
context.duration = 0.5 | |
topVC.view.animator().alphaValue = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import AppKit | |
class MyCustomSwiftAnimator: NSObject, NSViewControllerPresentationAnimator { | |
@objc func animatePresentationOfViewController(viewController: NSViewController, fromViewController: NSViewController) { | |
let bottomVC = fromViewController | |
let topVC = viewController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AddShowTransitionAnimator.swift | |
// TVShowForecast | |
// | |
// Created by Thomas Krajacic on 3.11.2014. | |
// Copyright (c) 2014 Thomas Krajacic. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// OutletRetention | |
// | |
// Created by Thomas Krajacic on 8.3.2015. | |
// Copyright (c) 2015 Thomas Krajacic. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AddShowTransitionAnimator.swift | |
// TVShowForecast | |
// | |
// Created by Thomas Krajacic on 3.11.2014. | |
// Copyright (c) 2014 Thomas Krajacic. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AddShowTransitionAnimator.swift | |
// TVShowForecast | |
// | |
// Created by Thomas Krajacic on 3.11.2014. | |
// Copyright (c) 2014 Thomas Krajacic. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func PanDownAction(sender: NSMagnificationGestureRecognizer) { | |
if sender.state == NSGestureRecognizerState.Began { | |
let vc = storyboard?.instantiateControllerWithIdentifier("C") as! NSViewController | |
showViewControllerDown(vc) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet var PanDown: NSPanGestureRecognizer! | |
@IBAction func PanDownAction(sender: NSPanGestureRecognizer) { | |
if sender.state == NSGestureRecognizerState.Began { | |
let vc = storyboard?.instantiateControllerWithIdentifier("C") as! NSViewController | |
showViewControllerDown(vc) | |
} | |
} |