user5633758
user5633758

Reputation:

Method in swift extension of an Objective-C class can not be access from .m file

Method in Swift extension of an Objective-C class can not be access from .m file

I have a bridge header:

extension foViewController {

   public func gome()
    {
        print("Hi");           
    }
}

I can't call method like [self gome]; in viewdidload of .m file

Upvotes: 3

Views: 5354

Answers (1)

user5633758
user5633758

Reputation:

To access Swift files in Objective-C classes, we have to add an import.

For example, if the project name is "De", add:

#import "De-Swift.h"

Only then we can access Swift files in Objective-C.

Upvotes: 4

Related Questions