Note: I\'ve read the apple documentation and studied a swift book.
I\'m confused on the difference between a \"type instance method\" (if such exists, corre
whyceewhite - thank you so much! You have clarified something that I could just not grasp! For those of you who come to this page and are operating on Swift 3+, please see the code below if you want to put the code into practice and see static in operation.
class Circle {
static let PI = 3.14
var radius: Double
init(radius: Double) {
self.radius = radius
}
// Returns the area of this circle
func area() -> Double {
return Double.pi * radius
}
// Ridiculous class method for demonstration purposes
static func printTypeName() {
print("Circle")
}
}
Then start trying Circle.printTypeName or the examples shown above! Great stuff!