-4

This is a class method and I am passing block as one of the argument So basically how pass blocks in swift?

+ (NSURLSessionDataTask *)getAllSongIfo:(NSDictionary *)userInfo withBlock:(void (^)(NSArray *songInfos, NSError *error))block;
Pradeep CR
  • 53
  • 1
  • 6

1 Answers1

0

Swift equivalent:

func getAllSongIfo(userInfo: NSDictionary, withBlock block:((NSArray?, NSError?) -> Void)) -> NSURLSessionDataTask

If you want a class method you need to add the class keyword like:

class func getAllSongIfo(userInfo: NSDictionary, withBlock block:((NSArray?, NSError?) -> Void)) -> NSURLSessionDataTask
matthias
  • 947
  • 1
  • 9
  • 27