Skip to content

Instantly share code, notes, and snippets.

@GlobakMaxim
Created September 27, 2017 09:37
Show Gist options
  • Save GlobakMaxim/d852bd14dc2dac0213f7dc68eb819d9d to your computer and use it in GitHub Desktop.
Save GlobakMaxim/d852bd14dc2dac0213f7dc68eb819d9d to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import UIKit
protocol DisplaySection {
var typeId: AnyHashable {get set}
var title: String {get set}
var items: [DisplayItem] {get set}
}
protocol DisplayItem {
var typeId: AnyHashable {get set}
var title: String {get set}
}
///////////
enum SectionType {
case main
case detail
}
enum ItemType {
case one
case two
}
class TestDisplayItem: DisplayItem {
var typeId: ItemType
var title: String
init(typeId: ItemType, title: String) {
self.typeId = typeId
self.title = title
}
}
class TestDisplaySection: DisplaySection {
var typeId: SectionType
var title: String
var items: [TestDisplayItem]
init(typeId: SectionType, title: String, items: [TestDisplayItem]) {
self.typeId = typeId
self.title = title
self.items = items
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment