20 lines
389 B
Swift
20 lines
389 B
Swift
|
/**
|
||
|
* Splash
|
||
|
* Copyright (c) John Sundell 2018
|
||
|
* MIT license - see LICENSE.md
|
||
|
*/
|
||
|
|
||
|
#if os(macOS)
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
extension CGImage {
|
||
|
func write(to url: URL) {
|
||
|
let destination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypePNG, 1, nil)!
|
||
|
CGImageDestinationAddImage(destination, self, nil)
|
||
|
CGImageDestinationFinalize(destination)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|