How can I make this objective c block parameter an optional in swift? -


i'm trying learn how combine objective c swift. in example want coord2d optional in swift, resulting swift block looks like:

photopicker.cropblock = { (coord2d: cllocationcoordinate2d?) -> () in 

here's how looks right though --- coor2d not optional, , instead return 0 coord2d.latitude , coord2d.longitude

//.h @property (nonatomic, copy) void(^cropblock)(cllocationcoordinate2d coord2d);   //.m - (void)cropaction {     if (self.cropblock) {         nsdictionary * dict = photoselected.asset.defaultrepresentation.metadata[@"{gps}"];         cllocationcoordinate2d coord;         coord.longitude = (cllocationdegrees)[[dict objectforkey:@"longitude"] floatvalue];         coord.latitude = (cllocationdegrees)[[dict objectforkey:@"latitude"] floatvalue];          self.cropblock(coord);      } }  //viewcontroller.swift photopicker.cropblock = { (coord2d: cllocationcoordinate2d) -> () in 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -