Swift Static Property

[Solved] Swift Static Property | Swift - Code Explorer | yomemimo.com
Question : Swift Static Properties

Answered by : samer-saeid

class University { // static property static var name: String = "" ...
}

Source : | Last Update : Thu, 23 Jun 22

Question : Swift static Property

Answered by : samer-saeid

class University { // static property static var name: String = "" // non-static property var founded: Int = 0
}
// create an object of University class
var obj = University()
// assign value to static property
University.name = "Kathmandu University"
print(University.name)
// assign value to non-static property
obj.founded = 1991
print(obj.founded)

Source : | Last Update : Thu, 23 Jun 22

Answers related to swift static property

Code Explorer Popular Question For Swift