Swift: I went there. I did that. redacted: is there a way to interpret strings as code? me: use Lisp redacted: i’d like to run swift code though Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window) Related June 17, 2015 By erica Development, Swift 5 Comments Tweet this Post Mirror Mirror on the WallMirror Mirror on the Wall
Careful, it might gain sentience 😐
So does this only work if users have Xcode installed or does this enable us to execute arbitrary Swift scripts whenever and however we like (ie as sort of replacement to AppleScript)?
This probably deserves a post of its own, but you can use System and NSTask to run anything (sandbox allowing), and Swift can be use directly to script at the command line.
Your use of 0777 for permissions isn’t really Octal – see the Swift Manual – you need a “0o” prefix (Swift iBook, section on “Numeric Literals”)
Even more so: I don’t need to change permissions at all. Feel free to delete those lines. They are leftover from an earlier experiment.