For example, I have this method in swift:
@objc class MyClass: NSObject .... @objc class func viewWithIndex(index: Int, str: String) { println(index, str) }
then I want to call this method in the objective-c class, and I expected as simple as this call [MyClass viewWithIndex:10 str:@"string"]; but it does not work.
What should I call it? Please, help.
Note. I already have an operational call to the objective-c function [MyClass showSomething]; , so I want to successfully configure the necessary settings for combining classes. My problem is only in a function that has two parameters. :)
It is decided:
I don't know what happened, but I just restarted my mac and uninstalled objc and it worked with a call [MyClass viewWithIndex:10 str:@"string"]; . I remember reading in the documentation.
Porting objective-c code to Swift
- To be accessible and useful in Objective-C, the Swift class must be a descendant of the objective-c class or must be marked as @objc.
source share