<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2016-01-20, at 13:23, zhaoxin肇鑫 <<a href="mailto:owenzx@gmail.com" class="">owenzx@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">Then I think the function with NSButton.self is the best. It makes least efforts for a programmer to get no mistakes.</div></div></div></blockquote></div><div class=""><br class=""></div><div class="">OK, thank you for your thoughts on this!</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I thought I’d mention that I got the idea for dropping the type parameter and shifting that to the caller by reading a blog post by Guille Gonzalez:</div><div class=""><a href="https://medium.com/@gonzalezreal/ios-cell-registration-reusing-with-swift-protocol-extensions-and-generics-c5ac4fb5b75e" class="">https://medium.com/@gonzalezreal/ios-cell-registration-reusing-with-swift-protocol-extensions-and-generics-c5ac4fb5b75e</a></div><div class=""><br class=""></div><div class="">The very last code snippet in that blog post does exactly that:</div><div class=""><br class=""></div><div class=""><span class="pl-k" style="color: rgb(167, 29, 93); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre;">let</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; background-color: rgb(255, 255, 255);" class=""> cell: BookCell </span><span class="pl-k" style="color: rgb(167, 29, 93); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre;">=</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; background-color: rgb(255, 255, 255);" class=""> collectionView</span><span class="pl-k" style="color: rgb(167, 29, 93); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre;">.</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre; background-color: rgb(255, 255, 255);" class="">dequeueReusableCell(forIndexPath: indexPath)</span></div></body></html>