Last active
June 6, 2018 16:18
-
-
Save danielctull/333d845ed4d8c18b5ed4f65e3353cd24 to your computer and use it in GitHub Desktop.
The following would error on 10.13, because NSImage.Name was a struct so the static property defined here was not available on String, with line 10 causing an error. With the macOS 10.14 SDK, NSImage.Name is a typealias to String, so additions to NSImage.Name via extensions are now actually extensions on String. π€
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
import Cocoa | |
extension NSImage.Name { | |
static var amazing: NSImage.Name { | |
return NSImage.Name("AmazingImage!") | |
} | |
} | |
let imageName = String.amazing | |
print(imageName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment