Here is my line of code in Swift, it calls a method:
networkManager.postUserProfile(self, onSuccess: {(username: String, userID: NSNumber, recommendedLessons: [AnyObject]) -> Void in
... code block
}, onFailure: {(error: NSError) -> Void in
... another code block
})
The networkManager
class is from Objective-C and is:
- (void)postUserProfile:(Profile *)profile
onSuccess:(void(^)(NSString *username, NSNumber *userID, NSArray *recommendedLessons))successBlock
onFailure:(void(^)(NSError *error))failureBlock;
And the error message is:
error: cannot convert value of type
(String, NSNumber, [AnyObject]) -> Void
to expected argument type((String!, NSNumber!, [AnyObject]!) -> Void)!
When calling a method, I understand that the !
operator will force-unwrap an optional. However in this situation, what is the meaning of the !
in the expected argument type?