batoulapps / Adhan

High precision prayer time library
MIT License
329 stars 63 forks source link

Getting the location from the user #73

Closed usamabinattique closed 7 years ago

usamabinattique commented 7 years ago

I have integrated the pod for swift3, currently using xcode 8.3.3. The location i.e latitude and longitude is hardcorded in the example provided in the documentation. I want to get the user location, how would i do that? I am already getting the city somewhere in the project but that uses the framework MapKit and we have to use the key .authorizeWhenInUse and it gets the location. Any help would be appreciated. Thanks.

z3bi commented 7 years ago

To get the user's current location you can do that using Apple's Core Location functionality. You can read more about it here https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

There are also lots of tutorials and other information available by searching for "Core Location". Once you get the coordinates, simply use those instead of the hardcoded ones used in the example and you will prayer times for the user's current location.