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?
iOS. Unfortunately, WebRTC is not supported on iOS now. Although WebRTC works well on Mac when using Firefox, Opera, or Chrome, it is not supported on iOS. Nowadays, your WebRTC application won't work on Apple mobile devices out of the box.
On iOS WebRTC is supported in iOS 13+, but only in Safari. Additionally, it's not supported in WKWebView.
A simple working iOS RTCDataChannel built using WKWebView. Rather than include the external native WebRTC iOS framework at https://webrtc.org/native-code/ios, this library leverages WebKit's inbuilt WebRTC functionality and exposes WebRTC functionality through the WKWebView control.
WebRTC Peer-to-peer connections is Not Supported on Safari 10, which means that any user who'd be accessing your page through Safari 10 can see it perfectly.
UPDATE 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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With