Created
May 15, 2018 16:00
-
-
Save bobgodwinx/bdafa2f382bd9b14247fc2df81e55196 to your computer and use it in GitHub Desktop.
PATs09
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
| /// 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