otherClass (). methodFromOtherClass () is the syntax for quick
If you need to pass a property with an external name, it could be:
otherClass (). methodFromOtherClass (propertyName: stringName) // example passing a string
To call a method for something if it returns the result of the method:
let returnValue = otherClass (). methodFromOtherClass (propertyName: stringName)
Example of accessing a property or function
class CarFactory { var name = "" var color = "" var horsepower = 0 var automaticOption = false func description() { println("My \(name) is \(color) and has \(horsepower) horsepowers") } } var myCar = CarFactory() myFirstCar.name = "Mustang" myCar.color = "Red" myCar.horsepower = 200 myCar.automaticOption = true myFirstCar.description()
Excerpt from: Apple Inc. "Fast programming language." interactive books.
Here you just call the method, but not a new instance of the class.
class SomeClass { class func someTypeMethod() {
source share