12

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?

3
  • 7
    Neither Swift nor Objective-C "supports" WebRTC. In both languages you can write code that implements the WebRTC protocols. You have found some Objective C code that does this. You can link to this code from Swift code
    – Paulw11
    Oct 14, 2015 at 9:58
  • 1
    Yes, supports hear means can write code to work with.
    – Khanh Tran
    Oct 14, 2015 at 15:49
  • swift is a language, webrtc is communication protocol. So cannot say language supports protocol. Better question: is there any webrtc framework implemented by swift?
    – Quang Hà
    Apr 9, 2020 at 5:11

4 Answers 4

9

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.

3

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.

1
  • Can you please write SimpleWebRTC as open source in Swift, we can contribute, appRTC is no use at all because its Google, they dont give but take from us only.
    – user285594
    Oct 13, 2016 at 20:20
1

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

-1

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

1
  • 18
    Please stop referencing Temasys, they are very business minded instead of contribution they are taking the business forward. Reference only free tools which has contribution not for money.
    – user285594
    Oct 13, 2016 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.