Shubham1164
Shubham1164

Reputation: 357

Can I use the combination of both swift and objective c in react native custom module, IOS?

Is it feasible to code some files in swift and some files in objective c while creating a custom module for IOS in react native. I need this because I know swift but I want to use already created code in objective c, while working on react native project?

Upvotes: 0

Views: 171

Answers (1)

Andrew
Andrew

Reputation: 28539

Yes you can use both. You need to have a bridging header so that the the Swift code can access the Objective-C code

These tutorials show you how to create native components using swift

https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03 https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-2-ui-components-907767123d9e

This tutorial shows you how to use Objective-C code in Swift and vice versa.

https://www.ios-blog.com/tutorials/objective-c/how-to-use-objective-c-classes-in-swift/

Upvotes: 1

Related Questions