Swift Computed Property
class Calculator {
// define stored property
var num1: Int = 0
...
}
SAMER SAEID
class Calculator {
// define stored property
var num1: Int = 0
...
}
class Circle {
var radius: Double = 0
}
extension Circle {
// define computed property
var area: Double {
return 3.14 * radius * radius
}
}
let circle1 = Circle()
circle1.radius = 5
print("Area:", circle1.area)