I am trying to use a objective c method with enum as argument in swift.The value for the argument is set based upon swift enum variable.
Swift enum
enum SecurityType: Int {
case pushNotification = 0
case touchId = 1
case faceId = 2
}
My enum in objective c file look like
typedef NS_ENUM(NSUInteger, ScreenType) {
TouchID = 1,
FaceID = 2,
ConsentApproval = 3,
VerifyMyIdentity = 4 };
My swift code is
let screenType: ScreenType = self.biometricType == .touchId ? .touchID : .faceID
guard let newVC = MyViewController.init(screenType: screenType) else { return }
In above method biometricType variable is of swift enum type.
Here is my init method
-(instancetype)initWithScreenType:(screenType *)type {
self = [super init];
if (self) {
UIStoryboard *passcodeStoryBoard = [UIStoryboard storyboardWithName:passcode bundle:nil];
self = [passcodeStoryBoard instantiateViewControllerWithIdentifier:@"AuthenticationViewController"];
self.screenType = type;
return self;
}
return nil; }
I am getting an error on init method
Cannot convert value of type 'EnumType' to expected argument type 'UnsafeMutablePointer!'
Can somebody have any idea what might be the reason behind it.
initmethod is defined, thats half the story.-(instancetype)initWithScreenType:(screenType *)type {=>-(instancetype)initWithScreenType:(screenType)type {without the*