“Swift Memberwise Initializer” Code-Antworten

Swift Memberwise Initializer

struct Person {
  
  var name = ""
}
SAMER SAEID

Swift Memberwise Initializer

struct Person {

  // define two properties  
  var name: String
  var age: Int
}

// object of Person with memberwise initializer  
var person1 = Person(name: "Dwight", age: 43)

print("Name:", person1.name)
print("Age:", person1.age)
SAMER SAEID

Ähnliche Antworten wie “Swift Memberwise Initializer”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen