​Swift is a strong and intuitive development language for macOS, iOS, watchOS and tvOS....

Page 214

Swift

studdet.marks = 98 studdet.markssecured()

println(studdet.marks) println(studdet.result) println(studdet.present) println(studdet.subject) println(studdet.stname) When we run the above program using playground, we get the following result: 98 true false Swift Protocols Swift

Mutating Method Requirements protocol daysofaweek { mutating func print() }

enum days: daysofaweek { case sun, mon, tue, wed, thurs, fri, sat mutating func print() { switch self { case sun: self = sun println("Sunday") case mon: self = mon println("Monday") case tue: self = tue println("Tuesday") case wed: 202


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.