I want to run a simple swift program on the command line.
I have the following files:
~/calcs/demo.swift (is executable)
#!/usr/bin/env xcrun swift
import Foundation
import calcs
println(aString())
~/calcs/stringFunctions.swift
import Foundation
public func aString() -> String {
return "1234";
}
If I invoke it $ ./calcs/demo.swift
it errors with ./calcs/demo.swift:4:8: error: no such module 'calcs'
If I replace it with import stringFunctions
it similarly errors. Or if I comment out import calcs
then it errors with use of unresolved identifier 'aString'
.
If I set FRAMEWORK_SEARCH_PATHS
to the parent directory ~/calcs
or ~
it does not successfully find the module either.
$ xcrun swift --version
Swift version 1.1 (swift-600.0.57.4)
Target: x86_64-apple-darwin13.4.0