I'm trying to create a Framework that I can use across platforms. I have successfully added the framework to a test app and this is what the test framework looks like. Quite simple, all I want to do is import the framework and call HelloComputer.getHello()
and get hello in return.
import Foundation
public class HelloComputer {
public func getHello() -> String {
return "hello world"
}
}
But when I import the framework this is what happens
Am I missing something? Why is it asking for a instance of its self?
You declared getHello()
as an instance method. Either call it like HelloComputer().getHello()
or define it as a class method:
public class func getHello() -> String {