This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define protocol | |
| protocol SimpleViewCellItem {} | |
| // Let all types, which you want to show in table view, comforms to that protocol | |
| struct Person: SimpleViewCellItem { | |
| var name: String | |
| var surname: String | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Init is automatically created | |
| struct Person { | |
| var name: String | |
| var surname: String | |
| } | |
| let person = Person(name: "Dante", surname: "Brazeal") | |
| //Assign person to another variable. | |
| var secondPerson = person | |
| //Change name of second person |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person { | |
| var name: String | |
| var surname: String | |
| init(name: String, surname: String) { | |
| self.name = name | |
| self.surname = surname | |
| } | |
NewerOlder