Declare a class with properties


I want to declare a new class with its own properties, create a new instance and also be able to access its properties.


// Declare our new class

class myClass {

	var myProperty : String
    init(prop: String) {
        // Called when a new object is created
        myProperty = prop

// Create a new object of myClass
let c = myClass(prop:"my property")


Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)