Swift snippet #2 โ€” Generic UITableView dequeue cell

Ritesh Gupta
Swift Snippets ๐Ÿš€
1 min readNov 29, 2016

--

Tuesday, 29th November, 2016

This generic method will allow you to get custom cellโ€™s reference without force casting! Generics allows the function to infer cellโ€™s type which goes something like this ๐Ÿš€..

let cell: CustomCell = table.dequeueCell(
withIdentifier: identifier,
for: indexPath
)

If you are wondering about the inception of Swift-Snippets or want to checkout more such snippets then you can find them here ๐Ÿ˜Š

--

--