All Objective C nearable example apps work; none of the Swift examples work

I have a stickers dev kit, and have been 100% successful using the Estimote App Store apps as well as all of the Objective C examples. But – so far I can’t get any of the Swift examples to work.

Environment: Xcode 7.2, El Capitan, testing on iPhone 6s Plus.

What appears to be happening is that the delegate method never gets called back in the Swift apps. For example, in AccelerometerExample-Swift, in MasterViewController.swift, nearableManager.startRangingForType gets executed, but the nearableManager delegate never gets called (tested using breakpoints). In the ObjC version, the nearableManager delegate gets called as expected.

I wonder if something got munged based on changes to Swift syntax … or perhaps the automatic connection to my Estimote Cloud account is working in ObjC but failing in Swift?

(Note that most of the Swift examples fail to build on Xcode 7.2 without syntax corrections; but AccelerometerExample-Swift seems to be ok).

Any help would be appreciated.

OK, I got the simple trigger example to work, and then the RangingExample-Swift.

It appears that each example had multiple incompatibilities with the latest Swift 2.1.1 syntax, often in function / method signatures. It appears that once these were fixed, things are starting to work. (It’s also possible that something else fixed itself along the way.)

Here’s an example: in RangingExample-Swift, the Swift code for the nearableManager delegate was shown as:

func nearableManager(manager: ESTNearableManager!, didRangeNearables nearables: [AnyObject]!, 
     withType type: ESTNearableType)  {

What works is:

func nearableManager(manager: ESTNearableManager, didRangeNearables nearables: [ESTNearable], 
    withType type: ESTNearableType)  {

Thanks for the note! The Swift examples weren’t in fact updated to the latest syntax, so it all makes sense. We’ll likely be removing them in favor of App Templates in the future, so I guess our motivation to update them has been a bit low as result.

You can check out our first stickers template, in Swift, here:
https://github.com/Estimote/iOS-SDK/tree/master/Templates/swift/Showroom

Feel free to let us know what you think about it, how you find it comparing to the current nearables examples, etc.

Thanks and I’ll check out that template.

UPDATE – the Showroom template seemed happy on Xcode 7.2 / Swift 2.1.1, no changes needed.

1 Like