Using Swift As General Purpose Scripting Language
One of the big advantages of Swift is that it gives you access to all Cocoa APIs and lets you use them in some very flexible ways.
One of those is the possibility to use Swift as a general OS “scripting” language – instead of bash, PyObjC or C or any other option that you might have opted for in the past. Moreover, you can do that entirely from outside of XCode – so write your Swift program in any editor and then simply use Terminal to execute it, as if it was pure script.
The obvious advantage of such approach is that you now have the same single language to handle iOS programming, OS X app programming and generic system/automation tasks that you might want to perform from the command line.
Let’s have a look.
Continue reading →