Created
June 19, 2015 13:44
-
-
Save jonallured/7db6ee6844ac8b56378b to your computer and use it in GitHub Desktop.
In-App WAC with Swift and unsafeBitCast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import ExternalAccessory | |
class ViewController: UIViewController, EAWiFiUnconfiguredAccessoryBrowserDelegate { | |
var accessoryBrowser: EAWiFiUnconfiguredAccessoryBrowser? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
accessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser.init(delegate: self, queue: nil) | |
accessoryBrowser?.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil) | |
} | |
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser!, didFindUnconfiguredAccessories accessories: Set<NSObject>!) { | |
for object in accessories { | |
let accessory = unsafeBitCast(object, EAWiFiUnconfiguredAccessory.self) | |
println(accessory.name) | |
} | |
} | |
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser!, didUpdateState state: EAWiFiUnconfiguredAccessoryBrowserState) {} | |
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser!, didRemoveUnconfiguredAccessories accessories: Set<NSObject>!) {} | |
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser!, didFinishConfiguringAccessory accessory: EAWiFiUnconfiguredAccessory!, withStatus status: EAWiFiUnconfiguredAccessoryConfigurationStatus) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment