How to use Swift and Objective-C in the same project

Learn to Code. Check out the all new Devslopes 2.0 – Visit https://devslopes.com to learn more

Devslopes 2.0 launches February 1st 2018! Get notified on special Early Bird deals! Visit https://devslopes.com

Learn how to use Swift in an Objective-C Xcode project and learn how to use Objective-C in a Xcode Swift project – Swift interoperability and Objective-C interoperability

If you liked this video be sure to subscribe and get more helpful programming tutorials https://www.youtube.com/devslopes

Devslopes is dedicated to teaching beginners and non-programmers all about building mobile apps for iOS and Android, Web, Backend and Blockchain development. We’ve taught over 200,000 students how to code.

Our students have gotten jobs, made career changes, launched and sold start-ups, & much more. Some are at companies changing the world.

▶ Learn more at http://devslopes.com/
▶ Instagram: https://www.instagram.com/devslopes/
▶ Facebook: https://www.facebook.com/devslopes/
▶ Twitter: https://twitter.com/devslope
▶ Snapchat: devslopes

Comments

MirzaBiz Vlogs says:

It is giving me error. It says unknown type name. It is not importing all the swift files.

1videoshow says:

Swift will only works for iOS7+

Wade Sellers says:

This video got me moving forward… and this S.O. got me that last bit. My app also started with a number which jacks up the Product Module Name and is something tricky to catch. Now I’m Swifting up my app at work! GET SOME!!!! https://stackoverflow.com/questions/24206732/cant-use-swift-classes-inside-objective-c

Sinead Tbc says:

Hi Mark – just wondering why you use ” _secondVC”?

Kai Yang Lim says:

What if project name (release / debug) has different name ?

Reginaldo Lopes de Oliveira says:

Nice Tips…. Tanks dude!

Jack Doe says:

Great tutorial! but mine doesn’t work in using swift classes in objc.
I did exactly what is stated step-by-step then i also checked the “Define Module” option under Packaging under Build Settings to be set as “YES”. Still I received “Unknown Type name” error on the swift Class that im trying to use in my objc Project. What seems to be lacking?

Eslam Abo El fetouh says:

hi thx fot the great video and your course is just amazing best course ever, i have a problem the button do navigate to swift and change the backgroundcolor but any changes i make in the swift ui doesn’t effect it at all and when i removed the swift UI background code from object c it navigate to blackscreen that is the button code :
_secondVc = [[SecondVC alloc]init];
_secondVc.view.backgroundColor = [UIColor redColor];
[[self navigationController] pushViewController:_secondVc animated:YES];

Will Mollard says:

It keeps saying the .h file was not found.

syed rehan says:

Great video mate.

Fayd3r says:

hey how can i call views with the swift class that i just created?

Farrukh Askari says:

Thank You

David Merchan says:

Wow me salvo la vida, Thanks!!!

Pashynia says:

Awesome. Thank you, man!

Abdul Yasin says:

Great tutorial. Thanks. Keep posting more videos.

Jens Kristian Jensen says:

Perfect tutorial for Swift < -> ObjC.
How about Swift < -> C, or even Swift < -> C++?
I have only found examples for C functions and simple types. How would you make structs/classes and their members/methods map to Swift equivalents?

John Reyes says:

Hi Mark, Thanks for posting this! It was very helpful to me. One thing I’d like to add for other users is if your project has some spaces or non alpha numeric characters, you need to substitute a “_” for the non alpha numeric character when adding the “ -Swift.h” to your objective C code. It took me a few minutes to figure it out :-)

Agent Argyle says:

This is great! Thanks! Just one question- when working across multiple projects in a Workspace, how does one target the Obj C classes we want to import to use in Swift from another project? I tried #import “../OtherProject/classpath.h” and the compiler doesn’t complain but the classes don’t auto-complete in swift.

Bravo Tang says:

Hi, I would like to ask whether the performance will be badly affected when mixing objective c and swift together in the same file?

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours