Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Struct Vs Class in Swift

class Bike {
  var color: String

  init(color:String) {
    self.color = color
  }
}

var bike1 = Bike(color: "Blue")

var bike2 = bike1

bike1.color = "Red"
print(bike2.color)  // prints Red
 
PREVIOUS NEXT
Tagged: #Struct #Vs #Class #Swift
ADD COMMENT
Topic
Name
5+3 =