Started React Native With Swift Instead Of Objective C - ios

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.

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.

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

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/

Related

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?
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/

DJI SDK - Sample tutorials in Swift

I was going through the DJI SDK and looking through the sample tutorials like TapFly and ActiveTrack Missions etc. but could only find the code in Objective C. Although they have mentioned that the code is available in Swift but I couldn't find it. Also, if it's only available in obj c, can I use the bridging header for the code using without making many changes in obj c while running my app coded in swift?
Everything in the MSDK-iOS is compatible with your Swift app

Is it possible to write iPhone app in both objective c and swift

My existing iOS app is in objective c language and i want to add more functionality in my app and i want to do that code in swift language.
So is it possible to create an app which contains both the languages(i.e. in objective c & swift) and Is my app will work fine?
In short answer, Yes.
If you have existing project written in objective-c then you can add new classes written in swift. You still have choice if you want to use swift 3.0 ot swift 2.0.
You have to use bridge class in order to achieve that. You will get more guide on Link provided on Apple website.
https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
However going forward it would make sense that you spend more time on Learning Swift as Apple is now leaning towards Swift 3.0.
Here is link quick guide.

Does Swift support WebRTC?

Our team is in process of electing programming language to develop a new iOS application in which we have to write features to support video conversation.
The backend is written using WebRTC, now we have to decide which language to use in the iPhone app and we prefer Swift in this case.
However, I'm not sure Swift supports WebRTC or not.
My initial research show that we can implement the features using Objective-C. I found an example written in Objective-C which you can find the source code here.
However, I'm not sure about Swift. Does Swift also support WebRTC?
UPDATE 2023
Unfortunately, as of 2023 there still appears to be no completely Swift framework that implements the WebRTC protocol. Although the iOS framework hosted at webrtc.org can be fairly easily used in Swift apps, it is written mostly in objective C.
For those stumbling on this question, who just want to get webRTC running in your app this is still relatively easy using the cocoapod
UPDATE 2016
The easiest way is to get webRTC in your project is to simply install the CocoaPod using the directions at https://cocoapods.org/pods/WebRTC
If you have never used CocoaPods before you will need to first follow this guide: https://guides.cocoapods.org/using/getting-started.html
Original Answer
The simple answer to the question is that there are currently no open source libraries written in Swift conforming to the WebRTC protocol. You can still compile the code from the official WebRTC project into your app. Directions which may not lead to a successful build can be found here: https://webrtc.org/native-code/ios/
Finally, to clarify Omkar Guhilot's answer: Skylink is a company with a closed source SDK that is designed to work only with their paid stun-turn service, and https://github.com/alongubkin/phonertc requires cordova, which may not be ideal for many native ios developers.
Webrtc comes with Objective C interface. I dont think they will move to swift interface anytime soon. But You can always use them via bridging headers. I have written apprtc (webrtc's demo) in swift 2.3 version with help of bridging headers in github link with a description in this blog . I have planned to write 3.0 version and a swift wrappers over it.
Current version of webrtc framework doesn't require any pods or any extra bridging headers.
The framework can be generated by following instructions on this Link :
https://webrtc.github.io/webrtc-org/native-code/ios/
If you follow them correctly you will generate a framework add that framework in your project and follow the webrtc necessary steps and you will have a WEBRTC integrated project.
To know what all steps are necessary follow this link from appear.in
:
https://tech.appear.in/2015/05/25/Getting-started-with-WebRTC-on-iOS/
This will get you to a stage where you will be able to make calls between a browser and any iOS 8+ device
Yes swift supports WebRTC and there is one more library which you can use in swift link:- http://skylink.io/ios/
And the link that you have shared to which is written in Objective C, we should be able to use that as well in swift by creating a Bridging header
Have a look at this as well https://github.com/alongubkin/phonertc
Thanks
Omkar

combining flex UI with native objective c into single ios application

I am running out of time can anyone suggest me a good solution for my problem
Problem:
I am working in a ios project in which they have a UI designed already in flex a year ago..Now I have done all the backend coding with objective-c using apple native (IDE) xcode ,Now i dont know how I am going to combine the flex UI with the backend Objective c coding to integrate into a single application.
With Adobe Native Extensions you can do it, but I warn you, it'll be a hard game to get it start. http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html

Resources