Skip to content

Instantly share code, notes, and snippets.

@DominikPetho
DominikPetho / SimpleViewHelper.swift
Created October 1, 2018 11:02
Simple types used in SimpleViewController
// 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
}
@DominikPetho
DominikPetho / .swift
Last active September 27, 2018 15:17
Struct-sample
//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
@DominikPetho
DominikPetho / .swift
Last active September 27, 2018 15:14
Class-Sample
class Person {
var name: String
var surname: String
init(name: String, surname: String) {
self.name = name
self.surname = surname
}