1

I am using Objective-C to consume a Swift Code that I am turning into a Framework/SDK eventually. I can not invoke the class Methods specifically to Objective-C, and I am getting this error

No visible @interface for 'class' declares the selector 'method'

Swift File

public class Example { public class func testOne() -> NSString { return "testOne"; } public func testTwo() -> NSString { return "testTwo"; } } 

Objective-C File

#import <ProjectModuleName-Swift.h> @interface ... @end @implmentation ... - (void) testing { Example *example = [[Example alloc] init]; NSString *testOne = [example testOne]; // does not work ; No visible @interface for 'Example' declares the selector 'testOne' NSString *testTwo = [example testTwo]; // does work } @end 

Obviously, by declaring class func it should require a different way to invoke it through Objective-C, but I have not seen any docs on this topic.

An example or help would be much appreciated.

1 Answer 1

2

Class methods are called on the class, not instances of the class:

NSString *testOne = [Example testOne]; NSString *testTwo = [Example testTwo]; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.