Рет қаралды 62,712
Head to squarespace.com/seanallen to save 10% off your first purchase of a website or domain using code SEANALLEN.
In today's video I show you how to show a user's location on a map in SwiftUI using MapKit and CoreLocation. We also discuss how to ask for location permission and handle the various permission states.
This tutorial was created in Xcode 13 and iOS 15 (betas).
*** Yes, I'm aware of the new LocationButton released with iOS 15. Because that requires iOS 15, that will be a separate video in the future.
If you like my teaching or presentation style, I've started creating my own courses:
seanallen.teachable.com/
CLLocationManager Documentation:
developer.apple.com/documenta...
Twitter:
/ seanallen_dev
Link to my book - How I Became an iOS Developer:
gumroad.com/l/sean-allen-origin
Timestamps
0:00 - What You’ll Learn
0:11 - Display a Map
3:13 - MKCoordinateSpan
3:58 - Begin User Location Process
5:10 - ViewModel & Architecture Discussion
6:28 - CLLocationManager Setup
8:57 - Check App’s Authorization & Request Permission
12:30 - Property List Setup for Location Permissions
13:42 - CLLocationManagerDelegate Setup
17:01 - Where to call checkIfLocationServiceIsEnabled()
18:10 - Set Location of Simulator
18:28 - Test Location Permission
19:09 - Center Map on User Location
23:17 - Light Refactor & Cleanup
Hired.com:
hired.com/x/1n01g
Check out my podcast, iOS Dev Discussions:
itunes.apple.com/us/podcast/i...
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Paul Hudson's Hacking With Swift:
gumroad.com/a/762098803
Donny Wals - Combine:
gumroad.com/a/909014131
Mark Moeyken’s SwiftUI Books:
www.bigmountainstudio.com/swiftui-views-book/fzc51
Objc.io Books (Thinking in SwiftUI & Advanced Swift):
gumroad.com/a/656585843
Ray Wenderlich Books:
store.raywenderlich.com/a/208...
Links to my iOS Dev Setup & iOS Dev Book Recommendations
www.amazon.com/shop/seanallen
#swift #softwaredeveloper #iosdeveloper