0

In Python or Haskell I can run a file inside the REPL (e.g., in Python execfile('foo.py')). How can I do the same inside the Swift REPL. I'm not using Xcode. I know if you put #!/usr/bin/swift at the top of a file, then you can run it from the shell, but I'd like to run from the interpreter.

jscs
  • 63,095
  • 13
  • 148
  • 192
xiaolingxiao
  • 4,653
  • 3
  • 33
  • 75

1 Answers1

1

You can't run a swift file from Swift REPL, but you can import a custom framework when running the REPL:

swift -F /path/to/ProjectName.framework

Then, import the framework:

> import ProjectName
redent84
  • 18,423
  • 4
  • 57
  • 85