How I can use CryptoSwift to my Objective-C project?
I have an Objective-C project and want to use Encryption Library CryptoSwift for that. I have successfully used the single Swift file into my Objective-C project, but how to use a Swift project as subproject to the parent project that was built in Objective-C.
I tried to use Cocoa pod too but to no avail.
You can use Cocoa pods but on the target at the build options you should set Embedded Content Contains Swift Code to YES.
See this tutorial for a detailed description.
Related
I'm working with the objective-c library OCR Mobile Vision, but i need Cocoapods with this implementation.
I have to extract the framework and add to Xcode Swift Project.
This is the Cocoapods site:
https://cocoapods.org/pods/GoogleMobileVision
I didn't find the instructions for separate the framework on the site.
The standard way of working with a CocoaPod is following the instructions from your first link. See the Creating the text detector section.
If you really want to pull the framework out of the CocoaPod. Load the link from the source attribute in the podspec to get a tar.gz file with the pod contents.
I am working on a Swift project using AFNetworking. I am using Cocoapods to manage my third-party Obj-C libraries and using bridge-header to import them in the Swift codes.
The problem is that I cannot use CMD+click to find the Swift API of those Obj-C classes (I am always led to Obj-C interface or implementation). I have to guess the format of API according to so-called Obj-C Swift Interaction and it is very annoying sometimes.
Is there any way I can directly check the Swift style API of existing Obj-C libraries?
Thanks in advance!
You can use Alamofire (swift version of AFNetworking) : https://github.com/Alamofire/Alamofire
I am trying to create a swift-based iOS 8 framework, and wanted to include Firebase framework into it. The instructions on Firebase site are only for importing Firebase into iOS apps, which uses bridging headers. Per Apple's instructions, bridging headers don't seem to apply to a Swift framework importing an Objective-C framework. I was looking at the Importing External Frameworks section on the Apple link. It specifies that: "When you import an external framework, make sure the Defines Module build setting for the framework you’re importing is set to Yes."
Despite that, I tried to manually create bridging header and adjusted Swift Compiler - Code Generation Building Settings, to no avail.
Would you know if the Firebase framework has Defines Module build setting set to Yes? If it does, then I'll keep digging into why I get "Use of unresolved identifier Firebase" after explicitly following Firebase instructions a few times. I am using Xcode 6 Beta 5. Any other suggestions and work-arounds are also deeply appreciated.
Here is a work-around I tried, that did not work:
In Xcode 6 Beta 5, I created a new Objective-C framework - SwiftFirebase. In it, I
imported Firebase framework, and the other five frameworks
set the -ObjC flag
copied references of all the .h files in Firebase Headers folder into the new framework - SwiftFirebase.
made those references from Project to Public
imported into the SwiftFirebase umbrella header
ensured that Defines Modules was enabled. It was, by default.
Build for Running.
Created a new Swift-based Framework: TestFramework to test the above SwiftFirebase, where I
Added SwiftFirebase from Debug-iphonesimulator into the new library
Created a new swift class
Imported SwiftFirebase
Added an init method, where I put in the sample swift code from Firebase quick-start.
Build for Running
Got an error compiling: "Firebase/Firebase.h not found"
My guess is that copying references of header files from a Firebase into another Objective-C framework and making them public is not an effective way of manipulating files. :)
Hate to wait for Apple's fix. Anything else I could try? Did I miss something in the above steps that you could think of? Many thanks!
I'm attempting to compile a Swift app with supplementary Objective-C files loaded via the bridging header. However, it gets as far as the first line:
#import <Foundation/Foundation.h>
and shows the error:
Could not build the module 'Foundation'
I've checked that the Foundation framework is included but no luck. I've tried various combinations of deployment targets, architectures, etc too. Has anyone else experienced this in Xcode 6 beta 5?
Doc says
Any Objective-C framework (or C library) that’s accessible as a module
can be imported directly into Swift. This includes all of the
Objective-C system frameworks—such as Foundation, UIKit, and SpriteKit
so you could just do
import Foundation
You cannot import Obj-C-Headers in C-Files.
(If you are using c in your project).
So I get the latest VLCKit to compile and I see in the xcode project it has it's Defines Module set to Yes in the project Build Settings, and it has the Product Module Name set to VLCKit.
I run make VLCKit to build the framework, everything builds and I get my VLCKit.framework file.
I embed that framework into my Swift based app.
If I use the bridging header, it complains that it can't find the VLCKit/VLCKit.h
from the swift side import VLCKit is also an error.
Anyone get this to work?
Well I managed to fix the issue by just creating a new project VLCKit won't play in my swift bridged project, which is another issue entirely. It will play in a purely obj-c project though.