PhilipsHue / PhilipsHueSDK-iOS-OSX

The Software Development Kit for Philips Hue on iOS and OS X (beta)
579 stars 169 forks source link

Compatible with swift 3? #113

Open jolaroux opened 7 years ago

jolaroux commented 7 years ago

Hello, I follow the instructions to integrate the SDK into my existing swift 3 project, and I'm getting an error in the objC header file that says swift can't find the <HueSDK_iOS/HueSDK.h> files, and thats after I imported the framework file and the Lumberjack files. Is this SDK compatible with Swift 3? Is that what this issue means? and if its not, please help me figure out what the problem is. Thanks so much!

ibuprofane commented 7 years ago

I am using the SDK with Swift 3, so it's definitely compatible. Since the library is obj-C the Swift version should be irrelevant. I believe there were only a few instances where XCode updated my code for some optionality issues, but otherwise there was no difference for me in upgrading from Swift 2 to Swift 3 either in code or performance. Have you checked for linking issues?

jolaroux commented 7 years ago

Thanks for giving me hope! Here's my problem. The first error it's giving me is that it can't find the <HueSDK_iOS/HueSDK.h> files, and the error is where I have the import statement in the Header file thats automatically created. and I added the -objC linker in the build settings. Can you think of what the problem is?

ibuprofane commented 7 years ago

This is what I have in my bridging file:

import <HueSDK_iOS/HueSDK.h>

import "PHBridgeSelectionViewController.h"

import "PHBridgePushLinkViewController.h"

If it's still not finding it, there's probably a reference missing somewhere; could be lots of reasons why, but I'd compare with the QuickStart app and make sure that you add the SDK to the appropriate place(s) in your project settings.

jolaroux commented 7 years ago

Oh hmm all I have in my bridging file is

import <HueSDK_iOS/HueSDK.h>

which is what it says to do in the instructions, How did you come to what you have? I'm ready to try anything. And yes i'll look at the quick start app

jolaroux commented 7 years ago

Huh in that last comment it didn't finish the import statement, its supposed to say <HueSDK_iOS/HueSDK.h'> after the import and i think in your comment it edited out the first one too.

jolaroux commented 7 years ago

"HueSDK_iOS/HueSDK.h'" is what it edited out of my last 2 comments

ibuprofane commented 7 years ago

Oh, interesting should be

#import <HueSDK_iOS/HueSDK.h>

jolaroux commented 7 years ago

Yeah thats what I have too, But that's all I have in my bridging file, and its saying it can't find the files. And I have already imported the iOSFramework folder, and the lumberjack files. So I don't know what to do but I'm looking :(

jolaroux commented 7 years ago

http://www.developers.meethue.com/documentation/apple-sdk this is what i'm following, thanks so much for your help by the way

jolaroux commented 7 years ago
screen shot 2016-09-23 at 5 48 19 pm screen shot 2016-09-23 at 5 49 16 pm

these are the error I'm getting, and the files in my project.

jolaroux commented 7 years ago

Could you possibly help with this if you can? I fixed on thing, It turned out that I wasn't selecting "Copy items if needed" when i put the SDK files in Xcode, but now I'm getting a different set of issues.

These are the errors I'm getting. http://imgur.com/a/Lc9LV

If you knew anything about how to fix this, that would be amazing!! Thank you so much

SamwiseChepoackra commented 6 years ago

Does anyone know the best way to implement selecting which group to affect with lightstate changes in swift 4?