1

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];

1 Answer 1

1

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

enter image description here

Step 2 After when you will just drag and drop Obj-c Classes Now a popup will show as

enter image description here

-> Click Yes

Step 3- Now Import your Obj-C Header in bridging class created

enter image description here

Step 4- You are done with configuration steps Now, Time to use that class

as, I created a Object for that class

enter image description here

Now use it with that created object as below

enter image description here

You accessed your objective-C code in Swift

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.