0

Problem

I'm tring to make simple Swift script using Swift REPL and MySQL connector from Perfect.

My directory looks like this

/Users/Me/Desktop/test
    |-sqlTest.swift
    |-MySQL.framework

According to this anwser command to launch script should look be

swift -I ~/Desktop/test/ sqlTest.swift 

but instead of success I'm getting

sqlTest.swift:1:8: error: no such module 'MySQL'

Question

So how I should add framework to REPL or maybe this is not possible at all?

Community
  • 1
  • 1
Błażej
  • 3,617
  • 7
  • 35
  • 62
  • 1
    Old video about swift scripting. At the end there was method how to link against framework: https://realm.io/news/swift-scripting/ – Alexander Doloz Apr 25 '16 at 13:02

1 Answers1

0

Ok turns out the right command pattern is

xcrun swift -F <path to direction with modules> <swift file>

So in my situation looks like this.

xcrun swift -F ~/Desktop/test/ sqlTest.swift 

But not every module will work and atm I don't know why. Also there is some problem use frameworks at Ubuntu. Swift REPL seams to not detect frameworks.

Błażej
  • 3,617
  • 7
  • 35
  • 62