Location permissions

When trying to get a user's location in iOS, we are required to ask the user's permission first–in order to do this, we need to tell the user why we are requesting the permissions. iOS will handle the asking of the questions, but we need to provide the question. We achieve this by adding an entry into our info.plist file.

To access the info.plist, head over to the file tree and select your project at the very top of the tree hierarchy, then in the main window select the Info tab–you should now see a list of keys already pre-populated by Xcode for our app:

To add an entry, select the bottom key and press the + button next ...

Get Learn SwiftUI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.