I am new in swift anyone help me to understand
what is the purpose ? I should be used class label type !
is it possible to declare Computed property and Observers with class Label type ?
both ,either or neither ?
thank you
I am new in swift anyone help me to understand
what is the purpose ? I should be used class label type !
is it possible to declare Computed property and Observers with class Label type ?
both ,either or neither ?
thank you
Type Properties can be created using either static or class keyword
class as well as static keyword.class keyword. They can only be used with static.Example:
class First
{
class var x : Int{
return 3
}
static var y : Int{
return 2
}
// error: class stored properties not supported in classes
// class var z = 10 {
// willSet{
// print(newValue)
// }
// }
static var w = 30 {
willSet{
print(newValue)
}
}
}
You can declare a class computed property
class Foo {
class var p0: String { return "p0" }
}
It is somehow possible but you need to use the static keyword
class Foo {
static var p0: String = "p0" {
didSet {
print("Did set p0")
}
}
}