Search code examples
objective-cswiftestimote

Read temprature on estimote ibeacon


In obj-c I can get the temprature from a beacon with this block :

- (void)readTemperatureWithCompletion:(ESTNumberCompletionBlock)completion

How can I do this with SWIFT with a closure. I have been studying closures but still not sure how to run this block in SWIFT.

Can anyone advise ?

Thanks


Solution

  • This worked for me:

    func beaconConnectionDidSucceeded(beacon: ESTBeacon) {
        NSLog("beaconConnectionDidSucceeded")
        beacon.readTemperatureWithCompletion() { value, error in
            NSLog("readTemperatureWithCompletion, value = \(value), error = \(error)")
        }
    }