Now i update the ReactiveCocoa to 5(version 4.2.2) for the swift3.
But there has not api rac_signalForControlEvents(.TouchUpInside) for UIButton,which i use in previous version
Is there anyone know? How to resolve that?
Some part of the Obj-C API have been divided in another framework : ReactiveObjC.
I needed to install this framework to access these methods.
Solution :
As stated in README (Objective-C and Swift section), those Objective-C
API are splitted out to ReactiveObjC framework. You need to add
https://github.com/ReactiveCocoa/ReactiveObjC as a submodule, link the
framework, then import ReactiveObjC.
Please see the following discussion on the issue :
https://github.com/ReactiveCocoa/ReactiveCocoa/issues/3197
Related
I create new project with CocoaPods (Xcode 9.3.1 and Swift 4.1)and of course use SnapKit in it.
and I want use third party class TreeView ,this class wrote by Objc.
How cloud I use SnapKit in class TreeView ???
I try to use the following steps but not working:
create new file named SnapKit-Bridging-Header.h
go to TreeView.m , import the header file (notice:It ends with '-Swift'):
#import "SnapKit-Swift.h"
compiling now is OK! and I can see LayoutConstraint (defined in SnapKit)and some other class in TreeView.m file
but when I use view.snp.xxx ,it complain "Property 'snp' not found ..."
So my Q is How could I use view.snp.xxx in ObjC file??? Thanks :)
Swift code is not fully interoperable with Objective-C.
You can only use such Swift elements in your bridging header that are supported by Objective-C. This library requires Swift, it doesn't say that it supports Objective-C, so it's likely you need to do extra adaptation efforts to support it.
In iOS 9+ you have NSLayoutAnchor API that is almost as easy to use as SnapKit
(see https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html ;
https://cocoacasts.com/working-with-auto-layout-and-layout-anchors/ ; https://theswiftlibrary.com/the-simple-way-of-creating-constraints-in-code)
This API is easy to use and compatible with Objective-C.
If you want to support iOS 8, you can use a backporting library like this one.
I do not know how to code in Objective-C and have to get an app working with the G Suite SDK so that I can get information about members of the groups. The problem is that in September Google changed how auth requests work, so this tutorial no longer works. I know I need to switch over to using GTMAppAuth, but it's all Objective-C.
I am currently working on YouTube Data API and trying to implement functions in Swift. The following is what I did:
Install GTMAppAuth using Cocoapods.
Add bridging header and import necessary headers.
The above 2 steps didn't result in a successful compilation, since xcode can't find the headers. I manually add header search path in build settings.
After doing these steps, I can access those Objective-C class & methods from Swift classes.
For the "how to use GTMAppAuth" part, I found an example here (though I haven't test it)
https://github.com/Alder85/AppAuthSwift
Maybe you can also find some hints here.
(Sorry for that this is just my experience and may not be a complete answer. I am new here in the stackoverflow and have too little reputations to post a comment.)
I am trying to build an iOS swift framework to display encrypted photos. Photos are sent by my server (something like a hashed binary file) after calling a specific API with specific details. I will then decrypt the photo, and display it to the user.
Correct and point me in the right direction if I am wrong, but swift only allows frameworks - meaning no static library. And this will expose my implementation details (such as the method to decrypt my photo).
What I would like to achieve is to create a cocoapod distributable framework for paid developers to implement (once they subscribe to me). It is supposed to expose simple public APIs, and hide implementation details.
I have tried various ways to achieve that but to no avail. I would really like to keep the implementation to swift codes only, with minimal Obj-C codes.
Build a swift framework, and build an objective-c static library as a wrapper
But I cannot seem to get it to work. Any idea if this is possible?
Build a swift framework in a swift framework
Stupid idea, i'm able to see the framework's implementation details within the other framework...
Build a swift framework, and build an objective-c framework as a wrapper
I cannot seem to get this to work either...
I have been working on this project for about 2 weeks now, and have been all over Googling for it. Just in case anybody would like to try, you may try to do the following and check if it works.
Cocoapods Friendly Framework
Implementation Details Hidden
Uses Alamofire (or any public framework that connects to internet)
Any help would be appreciated, thanks!
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
I try to add Alamofire framework for IOS using cocoapods and adding it directly to the project. I get a lot of compiler errors in both cases though I follow all the guides.
Perhaps somebody can help me?
What version of Xcode and Alamofire are you using?
I can see an error there for Do-While which was removed in Swift 2.0
I guess you need to Upgrade to Xcode 7. Then follow again the steps from Alamofire Readme Page on Github.
I personally prefer CocoaPod to add frameworks.