Swift中的Phillips HUE SDK [英] Phillips HUE SDK in Swift

查看:67
本文介绍了Swift中的Phillips HUE SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对Swift非常陌生!我确实有一些使用Objective-C的经验(尽管自从我写了任何东西以来已经有两年了).我正在尝试将Phillips HUE SDK与Swift一起使用,遇到了一些麻烦!我正在尝试将以下Objective-C代码重写为Swift:

I am very new to Swift! I do have some experience with Objective-C (although it has been around two years since i've really written anything in it). I am trying to use the Phillips HUE SDK with Swift, and am having some trouble! I am trying to re-write the following Objective-C code into Swift:

// Start search for bridges
[self.bridgeSearch startSearchWithCompletionHandler:^(NSDictionary *bridgesFound) {
   //Search complete
   [self showBridgesFound:bridgesFound];
}

我没有在网上寻找解决方案的运气,而且没有通过Phillips提供的文档.有没有人对此有经验,请您提供协助?

I have had no luck looking online for a solution on this, and there is no documentation through Phillips. Has anyone had experience with this, could you please provide assistance?

推荐答案

棘手的部分是弄清楚NSDictionary的Swift等效语法.

The tricky piece is figuring out the syntax of the Swift equivalent of the NSDictionary.

self.bridgeSearch.startSearchWithCompletionHandler { (bridgesFound: [NSObject : AnyObject]!) -> Void in
    self.showBridgesFound(bridgesFound)
}

这篇关于Swift中的Phillips HUE SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆