importing PebbleKit in Xcode 6 for use in swift - ios

I'm trying to develop a Pebble companion app in Xcode 6 using swift.
I've followed the instructions so far as could be followed from the pebble development site
Pod seems to install and link PebbleKit without any errors, but when I type the "import PebbleKit" directive in a swift file, it says module not found.
Not being an expert in Objective-C, (nor swift, for that matter) I'm at a loss as to why it isn't working.
Any insights?

For me worked the following solution.
1. I added the PebbleKit manually (all steps for this are described in the link provided by the question)
2. I made a Bridging Header file in the Swift project (check Bridging Headers)
3. In the created Bridging Header file, I wrote: #import
No need of adding 'import PebbleKit' into any Swift file! After I could use all classes from the PebbleKit framework without any problems.

Related

What is a correct bridging header for Flurry?

I’m trying to integrate Flurry using CocoaPods in my Swift project. "pod install" downloads Flurry in the project files, but I can’t set a correct path in the bridge-file for FlurrySDK (everything is fine with all other obj-c dependencies).
Where/how can I find a correct import path?
When you are using latest CocoaPod to install external dependencies to Xcode Project, you don't really need the bridging header to expose Objective-C methods to Swift. See below screenshots once to understand it clearly.
Creating and Installing Pods.
Importing Flurry SDK in a Swift class.
Hope this helped. Thanks.

Parse with swift for IOS application

I am a beginner to IOS applicaiton development as well as swift.I use Parse services for my application.
I have imported
Parse.framework,
ParseUI.framework,Social.framework,
Accounts.framework,
SystemConfiguration.framework,
Storekit.framework,
Security.framework,
QuartzCore.framework,
CoreLocation.framework,
CoreGraphics.framework,
CFNetwork.framework,
AudioToolbox.framework,
libsqllite3.dylib,
libz.dylib.
I have also imported UIKit,Parse and Bolts to all of my .swift files
But in any case,it shows use of unresolved identifier to Parse Objects when I use any Parse object.Why?Thanks for your attention.
Check out steps 2 and 3 here:
https://parse.com/apps/quickstart#parse_data/mobile/ios/native/existing
You might not have "Copy items to destination's group folder" checked.
Also, cocoapods is a great way to manage libraries. Check out this tutorial if you're interested:
http://shrikar.com/integrate-parse-with-swift-in-ios8-using-cocoapods/

Building a Swift framework with references to Objective-C code

I'm working on an iOS project written in Swift, and I would like to take some classes out of the regular "app" project, and bundle it into a reusable Swift framework instead (and maybe make it publicly available on Github and via Cocoapods).
I'm running into issues because frameworks seemingly can't have Objective-C bridging headers, but in order to compile my framework code, I need to reference several Objective-C classes (in this case: the Google Maps iOS SDK).
I've also added GoogleMaps.framework as a linked library in my framework project, but then, how can I "import" it from Swift code?
Is this even possible with the current tools and Swift version, and how should I proceed?
Thanks.
It wasn't that complicated, actually... I was just doing some things wrong.
First, bridging headers are not required in that setting: the Google Maps iOS SDK is provided as a regular .framework file, so the development language has no impact on how it can be imported in Swift. Apple clearly mentions it in the documentation: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html, "Importing external frameworks".
It's as easy as adding the framework to the "Link binary with libraries" section of the project settings. Do not forget to also add depending libraries and frameworks (in GoogleMaps.framework's case, there are quite a few).
Then, in Swift code, the framework classes should be available simply by doing:
import GoogleMaps
No bridging header, no dealing with "non-modular header etc." errors.

Objective-C bridging issue. How do I use an Obj-C framework in a Swift project?

I must have started from scratch about 4 times already. I've followed the solutions listed below but I still have an issue (which I think has something to do with the bridging header file).
Note: I have tried manually creating the bridging header as well as the automated solution Xcode offers when you drag some Objective-C files into a Swift project.
Swift Bridging Header import issue
Connect Objective C framework to Swift iOS 8 app (Parse framework)
Here are the main errors I am seeing. I've tried moving the header file up a level/down a level and it still claims to not see it. Everything is currently where Xcode put it when I selected "Yes" when prompted to created the bridging header automatically. You can also see the full contents of my bridging header.
The "Cannot find protocol declaration for NSObject" error usually refers to circular references problems.
I'm wondering why you put all those standard Apple frameworks in the bridging header? This might be the problem. This special file is supposed to "bridge" Swift and Objective C worlds together, so if you've already referenced and linked your app against those frameworks in your Swift code, you shouldn't need to do it again in the bridging header.
Try to remove all Apple-provided frameworks from your bridging header and only leave the specific ones (IBM....h), and see if it works?
If it doesn't, then start with Foundation/Foundation.h only...

How to add a swift file to Objective c pod?

I am working on my own private pod and wants to add a swift file to my existing Objective-C private pod.
When I tried to add .swift file Xcode created the Pods-Tests-Bridging-Header.h file.
In-fact I mentioned this file in build settings "Objective-C Bridging Header" also.
As I have read on apple developer docs Its says I have to import a "modfule_name-swift.h" in my files to access swift classes files.
And as separate Xcode project of Objective-C I am able to do that thing by importing "Project_name-swift.h" file in Objective-C Code.
While I am trying to same thing in Pods like "#import "Pods-Tests-swift.h" compiler couldn't recognize it and starts giving errors.
How to do that?
CocoaPods does not yet support Swift

Resources