0

I am have two existing projects. One I have written in ObjC and the other in Swift following along from online tutorials.

I would like to know how I can import the entire ObjC project into my Swift project.

Can this be easily done?

1
  • You can Use your all obj c class in swift project not entire obj c project. Commented Aug 31, 2017 at 5:01

3 Answers 3

2

Swift’s compatibility with Objective-C lets you create a project that contains files written in either language. You can use this feature, called mix and match, to write apps that have a mixed-language codebase. Using mix and match, you can implement part of your app’s functionality using the latest Swift features and seamlessly incorporate it back into your existing Objective-C codebase

Checkout this reference from Apple of how to import your Objective-C files into your Swift project.

The most important thing is the bridging header, checkout the reference above and follow the steps.

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

Comments

0

It depends what you mean by easy, is there a one-click solution? No. But you can drag all of your Obj-c stuff into your swift project and use it no problem though. You just need to set up a bridging header. (for storyboards and nibs you may need to reconnect some stuff)

If you are talking about using it as a framework then that is a seperate story.

Comments

0

For this First add bridging Header in your Project

enter image description here

Then Drag and drop your Obj c file in swift project and import this file in In YourProject-Bridging-Header.h ,see

#import "ObjectiveCClass.h"

After this You can use this class in swift class without doing anything more.

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.