• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
User Location & Array of CLCircularRegions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

User Location & Array of CLCircularRegions


  • Subject: User Location & Array of CLCircularRegions
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Thu, 27 Jul 2017 18:38:02 +0000

I am trying to get around the limit of 20 monitored regions for iOS. So, I
have an array of all regions (CLCircularRegions) and I have the user's
location. Based on that I want to unregister all regions, and then find the
closest 20 of them. How exactly should I do this?

var monitoredRegions:[CLCircularRegion] = []

...

monitoredRegions.removeAll()

...

// within a loop

let thisRegion = CLCircularRegion(center: centerLocation, radius: radius,
identifier: title)

monitoredRegions.append(thisRegion)

...

let location: CLLocation = CLLocation(latitude: self.myMapView.userLocation.
coordinate.latitude, longitude: self.myMapView.userLocation.coordinate.
longitude)



    for region in self.monitoredRegions {

        let fenceLocation = CLLocation(latitude: region.center.latitude,
longitude: region.center.longitude)

        let distance = location.distance(from: fenceLocation)

        print("Distance: \(region.identifier): \(distance)m")

         *// Push into a dictionary and then after this for loop, later
sort based on a key? Then use that to re-index the monitoredRegions?*

    }



Thanks,

Eric
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: [webkit-dev] How to display new MIME types?
  • Next by Date: To remove OS Control Strip touchbar
  • Previous by thread: Re: Cancelling state restoration on iOS
  • Next by thread: To remove OS Control Strip touchbar
  • Index(es):
    • Date
    • Thread