Implicitly Import Specific Swift Module

Implicitly import specific Swift module

Actually there's a very easy workaround I could have thought about earlier…

Simply add the following to your app project's Objective-C bridging header:

@import ModuleName;

Swift will pick it up too! No need for import ModuleName in every Swift file where you intend to use the module.

In our Swift file, where do I import the swift module?

The implicit import of the Swift module is a behaviour hard coded into the Swift compiler, exclusively for the Swift module.

Swift - Import my swift class

You don't need to explicitly import files in Swift as they are globally available through the project. If you want to access the methods or properties of Player class, you can directly make object of Player class in MainScene.Swift file and can access to it.
e.g var objPlayer = Player()

How do I import a Swift file from another Swift file?

I had the same problem, also in my XCTestCase files, but not in the regular project files.

To get rid of the:

Use of unresolved identifier 'PrimeNumberModel'

I needed to import the base module in the test file. In my case, my target is called 'myproject' and I added import myproject and the class was recognised.

Xcode 7.3: import Module displayed with strikethrough

This is a bug. We have fixed it in 218010af, which should be included in the Swift 2.2.1 release and is included in the 2016-04-12-a developer snapshot.

Getting 'no such module' error when importing a Swift Package Manager dependency

It turned out that Swift Package Manager implicitly depends on the project's Configuration names. I had them at live/qa instead of Release/Debug, and changing them back resolved the issue. Very odd, but I hope it saves you some trouble dear reader.



Related Topics



Leave a reply



Submit