Import Core Location
In this swift tutorial I discuss the topic of LocationManager Refactor out of your UIViewController. This will make your code much more readable, and keep those UIViewController small.
This video Contains How to implement a LocationManager as a singleton class and fetch a location from where every you need by a single line of code.
You can use this LocationManager for any other Views.
That makes sense to users what was going on right now in this UI Element.
Once you implemented it will help for your entire project. Because of you don't need to implement same line of code for each UIViewController, UIView or any object class.
As I mention in the video, a easy way to refactor LocationManager. If you prefer it another way, please leave a comment to let the community know.
If you like my way of teaching like my video and post a comment to know more What you are expectation.
And also If you have any suggestions post a comment to let me know more.
Subscribe on YouTube : https://bit.ly/KtrKathir
Follow me on WordPress: https://bit.ly/KtrKathir-blog
Like my page on Facebook: https://bit.ly/KtrKathir-fb
#Xcode #iOS #swift #CoreLocation #location #gps
Chapters:
0:00 Welcome and Intro
0:22 Creating CLLocationManager common class
2:14 Pre explanation Common class usage
3:38 Implementing Fetching location function
4:00 Conforming CLLocationManager Delegates
5:58 Creating LocationAddress struct
7:05 Implementing CompletionHandler
8:30 Getting user permission
9:38 Fetching LocationManager to UIViewController
14:52 Final output and Explanation