I've been struggling with this for a bit, I can't seem to load an image(I've tried absolute/relative paths and different folders). The app is to set the wallpaper using an image. Also for some reason the image file doesn't show up in Appcode but it does in the terminal.
import Cocoa
let screens = NSScreen.screens[0]
let imgurl = NSURL.init(fileURLWithPath: "cheese.jpg")
try! NSWorkspace().setDesktopImageURL(imgurl as URL, for: screens)
wallpapersetter/main.swift:32: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
I did some searching and thought it might be a sandboxing issue but sandboxing has been disabled when i tried it in xcode and it still didn't work. It's also quite difficult to find info as the majority of swift questions are about IOS