LemonPie
LemonPie

Reputation: 846

Started React Native With Swift Instead Of Objective C

So I started a react native app using create-react-native-app and it created a lot of boilerplate code. Android is in JAVA which I am fine with. But the iOS is in Objective-C and I am more familiar with Swift. Is there anything I can do about that? I know most of my code is going to be in JavaScript anyways, but just wondering anyways.

Upvotes: 7

Views: 3926

Answers (3)

Amar Hunter
Amar Hunter

Reputation: 1

You can convert swift to objective c or objective c to swift.

There are bunch of options for that, If you want to use javascript for converting than use obj2swift.js: https://github.com/okaxaki/objc2swift.

If you want to convert your code online than you can use online language converter like swiftify: https://swiftify.com/#/converter/code/

Upvotes: 0

Turnipdabeets
Turnipdabeets

Reputation: 6005

Unfortunately, there is not a simple or one command way to convert your iOS code in your React Native project from Objective-C to Swift. However if you want to write a Native Module, which you'll need to eject from CRN or start a new project with react-native init, you can write new code in Swift.

You might also be interested in this post on how to bridge Swift and Objective-C code. Basically when you create a new swift file you need to make sure to select “Create Bridging Header” when prompted.

Upvotes: 1

user10444815
user10444815

Reputation:

You're problem is not that clear. But lemme say this if you wanted to work on cross platform then react native is a good choice to that if you wanted to use javscript. Regarding on your question which is , lemme quote "But the IOS is in Objective C" which is you're wrong you can write an iOS native using both objective c , even c and c++ , ..and swift which you say your familiar with and if you're avoiding objective c then you can write iOS app purely in swift. Hope that helps.

Tips

1 for cross platform - and you want js (react native)
2. cross platform and you wanted to use c# (Xamarine)
3. iOS app which is native (Swift or objective c) or both
4. hybrid , you can try framework like ionic, cordova etc.
5. let us include android , you can use java(kotlin

Upvotes: 0

Related Questions