07-18-2023, 10:18 PM
In the Swift REPL, how to import (a.k.a. load, evaluate, require) a typical text *.swift file?
* I want to use the code from this file: `~/src/Foo.swift`
* Syntax like this doesn't work: `import ~/src/Foo.swift`
For comparison:
* An equivalent solution in the Swift REPL for a framework is: `import Foundation`
* An equivalent solution in the Ruby REPL for a *.ruby file is: `require "~/src/foo"`
These are similar questions that are /not/ what I'm asking:
* How to use/make a Swift command-line script, executable, module, etc.
* How to use/make an XCode playground, project, library, framework, etc.
* How to launch the REPL with a pre-existing list of files.
* I want to use the code from this file: `~/src/Foo.swift`
* Syntax like this doesn't work: `import ~/src/Foo.swift`
For comparison:
* An equivalent solution in the Swift REPL for a framework is: `import Foundation`
* An equivalent solution in the Ruby REPL for a *.ruby file is: `require "~/src/foo"`
These are similar questions that are /not/ what I'm asking:
* How to use/make a Swift command-line script, executable, module, etc.
* How to use/make an XCode playground, project, library, framework, etc.
* How to launch the REPL with a pre-existing list of files.