Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift Static Properties

class University {

  // static property 
  static var name: String = ""
  ...  
}
Comment

Swift static Property

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)
Comment

PREVIOUS NEXT
Code Example
Swift :: swift api call with certificate 
Swift :: implement swift protocol in kotlin 
Swift :: swift reading binary data 
Swift :: Swift Optional Binding (if-let 
Swift :: Create a Throwing Function Swift 
Swift :: swift converting time string to number 
Swift :: 95 dollars in rupees 
Swift :: continue keyword in swift language 
Swift :: Declare Constants in Swift 
Swift :: swiftui profile picture 
Swift :: Swift Labeled Statement with break 
Swift :: swift uibutton text resets to default 
Swift :: Swift Overriding Methods and Properties 
Swift :: AndroidManifest.xml:5: Error: Class referenced in the manifest flutter build 
Swift :: swiftui orientation failed after change orientation popup 
Swift :: remove child from scene swift 
Swift :: string to decimal swift 
Swift :: swift get last element of array 
Ruby :: rails skip authenticity token 
Ruby :: rails prepare testing db 
Ruby :: ruby array includes 
Ruby :: ruby file get line number 
Ruby :: ruby 2 decimal 
Ruby :: rails form fields 
Ruby :: ruby match word in string 
Ruby :: Ruby ruby-2.6.3 is present on the following stacks: heroku 16 
Ruby :: rails run rspec 
Ruby :: timeout in rails 
Ruby :: rails change resource name 
Ruby :: active admin with friendly_id 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =