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.
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.