简体   繁体   中英

Adding second swift file in Objective-c project has no effect

I have an objective-c project working. Now added swift file in it along with Bridging file and accessed that file from objective-c file. It is also working fine.

Now I am trying to add second swift file. After adding it, I tried to access it in obj-c file but couldn't.

I checked with "ProductName-Swift.h" file. It has interface declaration for first file alone. Second file declaration is missing.

Any help please?

You don't need a bridging header file if you want to import a Swift file to Objective-C.. Let's say your .swift is is SomeFile.swift . Then you import it using

#import "SomeFile-Swift.h"

See more here: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM