Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMCBeaconManagerDelegate #2

Closed
lfarah opened this issue Jun 28, 2016 · 1 comment
Closed

JMCBeaconManagerDelegate #2

lfarah opened this issue Jun 28, 2016 · 1 comment

Comments

@lfarah
Copy link
Contributor

lfarah commented Jun 28, 2016

Instead of this:

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(beaconsRanged(_:)), name: iBeaconNotifications.BeaconProximity.rawValue, object: nil)

We can have a delegate, so we can do this:

class MyClass {

func myFunc() {
    let beaconManager = JMCBeaconManager()
    beaconManager.delegate = self
}
extension MyClass: JMCBeaconManagerDelegate {

    /**Called when the beacons are ranged*/
    func beaconsRanged(notification:NSNotification) {
        if let visibleIbeacons = notification.object as? [iBeacon]{
            for beacon in visibleIbeacons{
                /// Do something with the iBeacon
            }
        }
    }  
}

What do you guys think? If approved, I can make the changes 😄

@izotx
Copy link
Owner

izotx commented Jun 28, 2016

I think it's a good idea have multiple ways to work with the library. It would be nice to have delegate.

@izotx izotx closed this as completed Jun 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants