Reputation: 163
I'm calling a method which is written in Objective C,
-(void)fetchWithDetails:(NSMutableDictionary*)details
success:(void (^)(id response))success
failure:(void (^)(NSError *error,NSString *userMessage))failure;
In Swift I'm calling the objective C method as :
ULWebServiceStoreUtility.fetch(withDetails: parameters as! NSMutableDictionary , success: { (response) in ....}, failure: { error, userMessage in ...})
But I'm getting crash error : Could not cast value of type 'Swift._SwiftDeferredNSDictionary' (0x11b1b84f8) to 'NSMutableDictionary'
So could somebody guide me how to pass NSMutableDictionary in Swift?
Upvotes: 1
Views: 216
Reputation: 130210
NSDictionary
is not directly castable to NSMutableDictionary
. The types are different.
You probably need something like this:
fetch(withDetails: NSMutableDictionary(dictionary: parameters), ...)
Upvotes: 1