Created
March 14, 2017 23:33
-
-
Save greenywd/d7fdc3d3933fc42f3aaa2d4fccca3944 to your computer and use it in GitHub Desktop.
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
//: Playground - noun: a place where people can play | |
import Cocoa | |
//path to image | |
let image = "/Library/Desktop Pictures/Sierra.jpg" | |
let url = NSURL.fileURL(withPath: image) | |
let workspace = NSWorkspace.shared() | |
let screen = NSScreen.main() | |
let dic: [String : Any] = ["NSWorkspaceDesktopImageScalingKey" : 1] | |
var result: () = try workspace.setDesktopImageURL(url, for: screen!, options: dic) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swift Playground code to change the wallpaper using Swift 3.