I'm building an app that uses geofencing but I realised that CLRegion has many limitations, for example:
that location authorizationStatus must be .authorizedAlways in order for region monitoring to work.
only circular regions can be monitored
This limits the functionality that can be applied using region monitoring. However after doing some research i found out that there are ways to change this behaviour by creating a custom class of CLRegion.
To be honest I have no idea how to do this or where to start. Does anyone have any suggestions as to how such a custom CLRegion class could allow customised geo-fencing?
There is a tutorial on appcoda that talked about this briefly, but it wasn't in depth at all, you can find it here:
https://www.appcoda.com/geo-targeting-ios/
There they suggest starting with protocols such as:
protocol RegionProtocol {
var coordinate: CLLocation {get}
var radius: CLLocationDistance {get}
var identifier: String {get}
func updateRegion()
}
protocol RegionDelegateProtocol {
func didEnterRegion()
func didExitRegion()
}
And from these one can create custom functionality for CLRegions, such as monitoring polygons etc.
How should one get started on implementing custom regions?
Thanks!