I’ve done a bit of research but I’m still not sure how to use core location within swift. I don’t understand the location manager and the delegates and stuff.
>Solution :
There are a couple important things to understand about corelocation conceptually.
-
Import the corelocation package, this will give you access to everything in the corelocation framework
-
Create a CLLocationManager object. This is the main class necessary for using corelocation.
-
Adopt the corelocation protocol and set the location manager delegate to whatever class adopted the corelocation protocol.
-
Request for the users permission. This is necessary because of apple privacy guidelines. Make sure to also add a location when in use/always usage key in your info.plist()
-
Implement the error and didupatelocations method
-
You can call location manager.requestLocation() and get the location.
Overall these are the main steps hope this helps.
Also in the future make sure to do more research before asking a question. There are a ton of good YouTube videos and articles that explain corelocation. Apple documentation is also very helpful.