Estimote / iOS-Proximity-SDK

Estimote Proximity SDK for iOS
https://developer.estimote.com
Apache License 2.0
61 stars 27 forks source link

Code examples in README.md are outdated #47

Closed fenuks closed 5 years ago

fenuks commented 5 years ago

I'm using SDK in latest available version at the moment, i.e. 1.4.1, and example snippets are inaccurate.

Below is fixed example.

        let credentials = CloudCredentials(appID: "your-app-id", appToken: "your-app-token")
        self.proximityObserver = ProximityObserver(credentials: credentials, onError: { error in
            print("Oops! \(error)")
        })
        // Define zones
        let blueberryZone = ProximityZone(tag: "blueberry", range: ProximityRange.near)
        blueberryZone.onEnter = { zoneContext in
            print("Entered near range of tag 'blueberry'. Attachments payload: \(zoneContext.attachments)")
        }
        blueberryZone.onExit = { zoneContext in
            print("Exited near range of tag 'blueberry'. Attachment payload: \(zoneContext.attachments)")
        }

        blueberryZone.onContextChange = { contexts in
            print("Now in range of \(contexts.count) contexts")
        }

        // ... etc. You can define as many zones as you need.

        // Start proximity observation
        self.proximityObserver.startObserving([blueberryZone])
chwastek commented 5 years ago

fixed with https://github.com/Estimote/iOS-Proximity-SDK/commit/8901207a4f00b05e94ad636a1f43cd120c9059bb