Generic function with AnyObject fails -
i'm trying use generic function i'm getting segmentation fault.
i'd simplify handling of restkit results creating generic function handle all. function cast array of result desired type, , call callback.
here's code
class func handlerestkitresult<t:anyobject>(mappingresult:rkmappingresult!,callback:([t])->void){ var resultarray = mappingresult.array(); if (resultarray [t]){ callback(resultarray [t]) } }
seems have no errors. when run it, segmentation default, , handlerestkitresult<t:anyobject>
.
specifically anyobject part. if remove however, warning t not conform anyobject.
am missing here?
i'm know theres way can pass name of class/type string, , sort of magic. i'm still wondering whats going wrong here.
thanks :)
Comments
Post a Comment