Search code examples
swiftmacosscriptingalamofire

Setting the framework search path for Swift scripts


I can run the REPL with a modified framework search path and import my build of Alamofire in the session:

$ swift -F /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Release/
1> import Alamofire
2>

However, running a script with content

#!/usr/bin/swift -F /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Release/

import Alamofire

gives me this error:

./test.swift:3:8: error: module file's minimum deployment target is OS X v10.10: /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Release/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule

Now what is that about? I'm on 10.12.


Solution

  • The above was with Swift 3.0.2. I can not reproduce it with Swift 3.1.