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.
Asked
Active
Viewed 471 times
0

jscs
- 63,694
- 13
- 151
- 195

xiaolingxiao
- 4,793
- 5
- 41
- 88
1 Answers
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,901
- 4
- 62
- 85