objective c - Cloudinary SDK in Swift project -
Is there any way to use Obje-C SDK in a swift file? I have tried to add a Clandery SDK to my project. I found a way to add libcloudinary.a for my project framework but it is not working.
UPDATE : Cloudinary has now published new SDK written in Swift language (Swift 3 and
Yes, you can.
first, you'll need to set up your Akskod projects according to their instructions. after a bridging will need to make the header file.
example
#ifndef Fun_Bridging_Header_h #define Fun_Bridging_Header_h #import "Cloudinary.h" #endif I had to work to create a factory class in Objective-c for < p> interface (Claudiarifactor H)
#ifndef Fun_Wrappy_h #define Fun_Wrappy_h #import "Cloudinary.h" @ interface CloudinaryFactory: NSObject + Create (CLUploader *): (CLCloudinary *) Clauderini representatives: ( ID & lt; CLUploaderDelegate & gt;) Representative; @end #endif
Implementation (CloudinaryFactory.m):
#import "CloudinaryFactory.h" @ Implement CloudinaryFactory + (CLUploader *): (CLCloudinary *) Claudine Representative: (id & lt; CLUploaderDelegate & gt;) Representative {Return [[CLUploader alloc] init: Claudiree Representative: representative]; } @end
and updated bridging file
#ifndef Fun_Bridging_Header_h #define Fun_Bridging_Header_h #import "CloudinaryFactory.h" #endif
< / Pre> Now, to use it:
var Image: UIImage? // todo: I'm assuming that you will set it somewhere @abacation funnel uploader (sender: AnyObject) {clouder = CLCloudinary (url: "cloudinary: // your: cloud url") upload = UIImagePNGRepresentation (image ) As NSDTU uploader = cloudfire. Create (Claude, Rep: Auto) Uploader. Upload (forUpload, option: ["public_id": "testo"]}}
I hope it helps! For more, here is the related
Comments
Post a Comment