1

I'm kicking the tires of Swift a little. I'm not using Xcode. I just have a simple .swift file and #!/usr/bin/env swift at the top of the file.

In the file, I have import Blahblah and a file called Blahblah in the same directory.

I get error: no such module 'Blahblah' however when running the .swift file.

How do I import the swift module? Is there something special I need to do?

StevieD
  • 6,925
  • 2
  • 25
  • 45
  • 1
    You don't need to import local content (relative to the project), they are included automatically. `import` is used for importing third party libraries (including those provided by apple, like `UIKit`, for example) – MadProgrammer Feb 09 '20 at 22:48
  • I should have mentioned I'm not in Xcode. Trying to figure this out old school. Is there a way to tell swift to search current path dir? Perl has the "lib" directive for this. – StevieD Feb 09 '20 at 22:59
  • Does this answer your question? [What does a module mean in swift?](https://stackoverflow.com/questions/48426344/what-does-a-module-mean-in-swift) – byaruhaf Feb 10 '20 at 00:44

0 Answers0