Created
May 7, 2019 18:22
-
-
Save KyNorthstar/63f84d5f7fd8c9b3c9501d1b68110983 to your computer and use it in GitHub Desktop.
NSAnimationContext.runAnimationGroup in OS X 10.11 and older
This file contains hidden or 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
// By Ben Leggiero on 2019-05-07 | |
// License is BH-1-PS: https://github.com/BlueHuskyStudios/Licenses/blob/master/Licenses/BH-1-PS.txt | |
import AppKit | |
public extension NSAnimationContext { | |
/// Allows those who must support old versions of macOS / OS X to use the better, modern block syntax | |
public static func __shim__runAnimationGroup(_ changes: (NSAnimationContext) -> Void, | |
completionHandler: (() -> Void)? = nil) { | |
if #available(macOS 10.12, *) { | |
return runAnimationGroup(changes, completionHandler) | |
} | |
else { | |
beginGrouping() | |
current.completionHandler = completionHandler | |
changes(current) | |
endGrouping() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment