A third-party class library written in objective-c language can be called in Swift.
Before calling, need a bridge file, this file in the first import OC Library when the project will be prompted to create, this time as long as the answer is "yes" can be, if missed this opportunity, we can also manually add, the steps are as follows:
For example, the project name is: HelloWorld
Right-click Project-"New file-" Header file
Named: Helloworld-brigding-header.h can be
The experiment can also be named Xxxyy-brigding-header.h, which is especially handy when the project is named with the Chinese name.
Write in File:
#import "ClassName.h"
Additional configuration is required in the project:
Item-"Builde Setting-" Objective the value in bridging header is set to Helloworld-brigding-header.h
It is important to note that to ensure that the file path is correct, you may need to write:./project name/helloworld-brigding-header.h in this form.
Xcode 6 Swift calls Objective-c class Couxia file naming