Question: I am new to swift. I am not able to get a callback to centralManagerDidUpdateState:: w/ following in playground (i.e.: i thought initialization would call back into centralManagerDidUpdateState):

```
import CoreBluetooth
class BTDiscovery:NSObject,
CBCentralManagerDelegate {

    func centralManagerDidUpdateState(central: CBCentralManager!) {
        println("here")
    }
}

var bt = BTDiscovery()

```

---

Is Core Bluetooth supporting in the iOS Swift playground?
I tried this for OSX playground and IOBluetooth. This also didn't work. What am I doing wrong?

Thank you.

Answer: 
I think what you're running into is the playground is inherently synchronous while the BlueTooth discovery is asynchronous. To allow it to work you need to add some things to your playground to allow asynchronous operation:

```
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)

```

Also note that since the iOS playground is run on the simulator, I wouldn't necessarily expect CB to work there at all.

You also have more fundamental problems in that you're not doing anything to actually trigger discovery. You need to create an instance of `CBCentralManager` and use it to drive the discovery process:

```
import Cocoa
import XCPlayground
import CoreBluetooth

class BTDiscovery:NSObject, CBCentralManagerDelegate {

    func centralManagerDidUpdateState(central: CBCentralManager!) {
        println("here")
    }

}

var bt = BTDiscovery()
var central = CBCentralManager(delegate: bt, queue: dispatch_get_main_queue())

XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)

```
Either `XCPSetExecutionShouldContinueIndefinitely` nor `PlaygroundPage.current.needsIndefiniteExecution` will work. 

Please keep in mind CoreBluetooth only works on device. Which means currently it won't work on the Playground.