Alvin Varghese
Alvin Varghese

Reputation: 822

Using RestKit in Swift

I have successfully added 'RestKit' pod into my project and also followed steps described in this article: Cocoapods in swift. I imported the RestKit into my ViewController class's source file:

import RestKit

But I don't know why I can't access it. It doen't show any of the classes in the RestKit. It shows:

'RestKit' No such module exists.


I tried again creating a new project and added 'RestKit'. and created a bridging header and imported 'RestKit' into ViewController claas's source file. Now i run the project it shows errors like

 //  in this file Pods-SOCKit-prefix.pch

    #ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #endif

    #import "Pods-environment.h" // Pods-environment.h file not found

 //  and also in this file Pods-TransitionKit-prefix.pch


    #ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #endif

    #import "Pods-environment.h" // Pods-environment.h file not found

If someone knows what's the problem behind this, please explain it to me, and suggest a way to work with RestKit in Swift.

Upvotes: 6

Views: 6519

Answers (1)

Mark Horgan
Mark Horgan

Reputation: 3313

I'm not sure what the Cocoapods problem you are having. I added RestKit to my bridging header and didn't need to add import RestKit to my Swift file.

My bridging header looks like the following:

# if you are using Core Data:
#import <CoreData/CoreData.h>

#import <RestKit/RestKit.h> 

# if you are using Core Data:   
#import <RestKit/CoreData.h>

Upvotes: 9

Related Questions