I've been trying to use Facebook Messenger SDK in my Swift Project. And the problem is that Facebook only shows how to use in Objective-C. I'm having trouble calling methods from the FBSDKMessengerShareKit. I've made bridging header and added FBSDKMessengerShareKit for import. The bridging header is like this
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKMessengerShareKit/FBSDKMessengerShareKit.h>
#ifndef myProject_Bridging_Header_h
#define myProject_Bridging_Header_h
#endif
This is how Facebook shows how to share an image in Messenger with Objective-C
if ([FBSDKMessengerSharer messengerPlatformCapabilities] & FBSDKMessengerPlatformCapabilityImage) {
UIImage *image = [UIImage imageNamed:@"myImage];
[FBSDKMessengerSharer shareImage:image withOptions:nil];
}
The way I'm changing it into Swift
if (FBSDKMessengerSharer.messengerPlatformCapabilities() & FBSDKMessengerPlatformCapability.Image) {
let myImage = UIImage(named: "myImage")
FBSDKMessengerSharer.shareImage(myImage, withOptions: nil)
}
My Swift code cannot be built and it always shows the error "Could not find an overload for '&' that accepts the supplied arguments"
I don't know what's wrong with my Swift code, Do anyone know how to use MessengerSDK in Swift?