ios - variable in generic class cannot be represented in objective c -



ios - variable in generic class cannot be represented in objective c -

trying create generic viewcontrolelr takes model type , handle pagination, etc. getting next error. there workaround this?

variable in generic class cannot represented in objective-c

class basepaginatingviewcontroller<t: basemodel>: uiviewcontroller { @iboutlet var tableview: uitableview! }

no, there no generics in objective-c unless want utilize c++ templates discourage.

the closest can in objective-c passing 'id' , confirming whether kind of object recognize 1 of below:

if([o respondstoselector:@selector(mymethod)]) { [o mymethod]; if([o conformstoprotocol:@protocol(myprotocol)]) { [o mymethod]; if ([o iskindofclass:myclass.class]) { // something. }

but if want it... follow this:

http://overooped.com/post/22516989979/tctypesafety

ios generics swift

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -