ios - Why isn't the parameter not passing as ViewController? -
i trying pass viewcontroller parameter, keep getting error. not sure why error occuring. appreciated. 
class major: uiviewcontroller, uicollectionviewdelegate, uicollectionviewdatasource{  let initial = json.finddetailclass(self viewcontroller, predicate: predicate)   }  func finddetailclass(viewclass: major, @noescape predicate: json -> bool) -> json? {      if predicate(self) {         return self     }     else {         if let subjson = (dictionary?.map { $0.1 } ?? array) {             json in subjson {                  if let foundjson = json.findmultiple(viewclass uiviewcontroller //this error, predicate: predicate) {                     let shorten = foundjson["html"].stringvalue                     print(shorten)                  }              }           }     }     return nil }      
if wanna pass viewcontroller parameter, using type parameter type [anyobject].
anyobject likes id in objective-c. can understand type of object of pointer.
func finddetailclass(viewclass: anyobject, @noescape predicate: json -> bool) -> json? ......
and , can convert viewclass real type of object while you're using object.
Comments
Post a Comment