Rss Feed
  1. Alternative to instanceType in Swift

    Tuesday, August 23, 2016

    In case you have not noticed, there is no straight forward alternative to using 'instanceType' in Swift. You might have tried using "Self" in place of instanceType like shown in the below code snippet.

    But turns out it gives an error saying the object cannot be converted to type Self. I found this elegant solution posted by Martin R on StackOverflow and it uses Generics.


    |


  2. 0 comments:

    Post a Comment