Reputation: 929
I have an Objective-C based cocoa pod framework. This framework has a class with XIP view controller. I want to access this controller from a Swift based project. The below code is Objective-C code. I need to use it in a Swift based project.
ViewController * viewController = [[ViewController alloc] initWithNibName:@“VController” bundle:nil];
viewController.delegate = self;
viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[vc presentViewController: viewController animated:true completion:nil];
Upvotes: 1
Views: 66
Reputation: 4855
Its simple just follow some steps and you are able to do That
I have a project and I am using RIOInterface.h Obj-c in My swift project
Step 1- Just add Objective c file in Swift Project
I added RIOinterface.h and .mm in my project
Step 2 After when you will just drag and drop Obj-c Classes Now a popup will show as
-> Click Yes
Step 3- Now Import your Obj-C Header in bridging class created
Step 4- You are done with configuration steps Now, Time to use that class
as, I created a Object for that class
Now use it with that created object as below
You accessed your objective-C code in Swift
Upvotes: 1