Skip to content

Instantly share code, notes, and snippets.

@bobgodwinx
Created May 15, 2018 16:00
Show Gist options
  • Select an option

  • Save bobgodwinx/bdafa2f382bd9b14247fc2df81e55196 to your computer and use it in GitHub Desktop.

Select an option

Save bobgodwinx/bdafa2f382bd9b14247fc2df81e55196 to your computer and use it in GitHub Desktop.
PATs09
/// Usage of shadowed protocol styled type erasure
let rows: [TableRow] = [ProductCell(name: "Hello"), ItemCell(id: "123456")]
for row in rows {
if let cell = row as? ProductCell {
cell.configure(with: Product())
}
if let cell = row as? ItemCell {
cell.configure(with: Item())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment