ios - How to declare generic type in Xcode 7 for blocks -
i did simple test generic type support in xcode 7 follow:
@interface mtbaselistviewcontroller <t> : uiviewcontroller - (void )requestwithblock1:(void (^)(t data ))block; - (void )requestwithblock2:(void (^)(mtlistpagingmodel<t> *data ))block; @end;
the interface compile without problem.
then in class use it
@interface mttestviewcontroller : mtbaselistviewcontroller <mttestmodel *> @end @implementation mttestviewcontroller - (void )requestwithblock1:(void (^)(mttestmodel *data ))block { } - (void )requestwithblock2:(void (^)(mtlistpagingmodel<mttestmodel *> *data ))block { } @end
both methods complaint "conflicting parameter types in implementation ...."
i see enumerateobjectsusingblock
method in nsarray<objecttype> (nsextendedarray )
support type infer inside block. think should problem didn't declare type in right way?
Comments
Post a Comment