Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

iOS Geofencing With Over 20 Locations - Algorithm

I'm looking for advice on the algorithm for this. My thought is to have a local database with the GPS coordinates of all the locations. I would then gather the user's location and use a loop to do a search that would check equal distances in all directions around the user's location for a point. It would query the DB, expanding the search radius each time until it had 20 results and it would add geofence monitoring to those regions and would do updates on Significant Location Changes.

Would this work? Is there a better way? Would all that database querying kill performance of the app and/or battery life? The database would be Realm.

Any suggestions Amit Bijlani, Pasan Premaratne, et al?