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
Related
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.
I have installed an obj-c framework in my swift project using cocoapods. In my bridging header file I have imported the framework which works fine.
#import "libPhoneNumber_iOS/NBPhoneNumberUtil.h"
#import "libPhoneNumber_iOS/NBPhoneNumber.h"
However I can't seem to use the classes in my project
let phoneUtil = NBPhoneNumberUtil()
This gives an error that I am using an unresolved identifier.
In my podfile I have use_frameworks!, but I can't import the classes directly in a swift class. In my build settings also I have already set the configuration to use the pod-config file.
The framework works fine if I add it manually to my project (not using cocoapods) and import in my bridging header.
Is this problem a problem with cocoapods or am I doing something wrong? Can't seem to find a way for this to work. Any help would be appreciated. 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).
I am trying to install PDFKit framework in Objective-C. I have x-code 4.4.1 but am unable to see the PDFKit Framework in build phases. Is the framework discontinued from iOS 5 ?
I want to use the the framework to view and annotate a pdf.
Can anyone let me know.
I don't think it was ever available in ios. Why don't you search for it in apple's reference manual for ios?
PDFKit is now available on iOS 11. Please refer to this answer on Objective-C implementation
Is phonegap just a wrapper for Device APIs or can I use it as a bridge to my own ObjC classes and methods? I don't see anything in the DOCs that says I can call my own code.
PhoneGap gives you the options to write plugins that you can use as a bridge betweeen your .js and your custom ObjC listener class. The negative is that you'll have to write a native version of your class for each mobile platform. However, I was able to get my ObjC plugin running in a matter of minutes after reading the tutorial.
http://wiki.phonegap.com/w/page/36753496/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20iOS