Jump to content

Not so much a suggestion as a question: Swift?


Recommended Posts

I've been reading through Apple's manual and I think Swift would make a pretty good scripting language. I don't know if Apple will allow Swift apps to be run from the command line:

 

swift hello.swift "{query}"

 

but would folk be interested in building workflows with it, if they did?

 

Just curious.

 

Link to comment
Share on other sites

Swift is a compiler. You can run thing interpreted, but it is designed as a compiler. Therefore, if you create a workflow using it (like I do go), it would run a compiled program. Nothing special for Alfred to support. You can look at my Alfred Time Keeper and Title Case Server workflows to see how to use go in an Alfred workflow. The same procedure would work for Swift.

 

I am currently learning Swift to use it like this. Watch out for future workflows from me that make use of a swift compiled program.

 

Those interested: The minimal hello world program in go compiles to 2.1Mb. The same type of program is only 32K in swift!!!!

Link to comment
Share on other sites

That is what the documents say. It is just a developers thing.  Just like you have to download Xcode to get any compiling tools on your Mac right now.

You can install Apple's Command Line Tools (free developer account needed) instead of Xcode for compiling code. They're sufficient for compiling most Homebrew libraries, for example, and will save you many gigabytes of disk space.

But I'd be surprised if there's a Swift-enabled version version when Yosemite comes out.

Link to comment
Share on other sites

That's a shame. A command-line runtime would be brilliant.

You can run in on the command line if you have Xcode installed:

 

/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

 

Use the -i flag to interpret the code, no flag compiles it.

Link to comment
Share on other sites

You can run in on the command line if you have Xcode installed:

 

/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

 

Use the -i flag to interpret the code, no flag compiles it.

 

Fair enough, but it would be great if they baked the runtime hooks into the OS, as they seem to be doing with JavaScript.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...