Question 15 : What are Instance properties and type properties in swift?
Answer 15: Instance properties belong to the instance of a type ,for better understanding one can say that they belong to the object instance of a Class type. With every new instance a new copy of instance properties is made which is a different entity from same property of different instance.
Type properties on other hand are associated with a type they are common to all instance of a type.Type properties are defined using static keyword
class SomeClass { static var storedTypeProperty = "Some value." //type property var storedInstanceProperty:String? // instance property }
Question 16 : What is defer statement? Why are they used?