SwiftUI-MAP

2020令和2年 6月29日


Apple Map
【Xcode】超初心者のためのSwiftUIチュートリアル3
【SwiftUI】MapKitを導入して地図を表示する

Add an annotation to the map
Add a layer to the map
Create a map view compatible with SwiftUI

MapKit Tutorial Getting Started

VIDEO有 source有 実行済 任意地点annotation設置 更にタップ対応
↓annotation
Advanced MKMapView with SwiftUI-1 source有
Customizing MKMapView annotations-2 source有

↓現在位置表示 videoのみ source無し
Integrating Maps with SwiftUI
LocationWhenInUseUsageDescription
LocationAlwaysandWhenInUseUsageDescription

Info.plistへの入力について
Privacy – を入力すると、自動で複数リストが表示される。それらから以下を選択。
Privacy – Location Always Usage Description
Privacy – Location When In Use Usage Description

以下は不要!!
更にvalue欄に以下を入力する。
NSLocationWhenInUseUsageDescription

[iOS 10] 各種ユーザーデータへアクセスする目的を記述することが必須になるようです


2020-07-03 14:13:21.244363+0900 swiftui-mapview[7142:3376076] This app has attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an “NSLocationWhenInUseUsageDescription” key with a string value explaining to the user how the app uses this data
2020-07-03 14:13:21.297063+0900 swiftui-mapview[7142:3376076] Metal API Validation Enabled
2020-07-03 14:13:21.244363 + 0900 swiftui-mapview [7142:3376076]このアプリは、使用法の説明なしでプライバシーに敏感なデータにアクセスしようとしました。 アプリのInfo.plistには、アプリがこのデータをどのように使用するかをユーザーに説明する文字列値を含む「NSLocationWhenInUseUsageDescription」キーが含まれている必要があります
2020-07-03 14:13:21.297063 + 0900 swiftui-mapview [7142:3376076]有効なMetal API検証


Communicating with a MapKit coordinator


swiftui Google Map
SwiftUIでGoogleMapsを表示するには


navermap iOS
NAVER Map iOS SDK


SWIFT UI シリーズ(MAP外)
SWIFT UI シリーズ ★100 Days of SwiftUI
↑の補足資料
五日目:関数は値を返すことができ、ここでも、返されるタイプを指定するだけです。複数のものを返したい場合はタプルを使用します
Functions with Multiple Return Values

Answertopia SwiftUIを使用したカスタムビューの作成

ビデオ視聴済The Complete Guide to NavigationView in SwiftUI
What’s new in SwiftUI for iOS 14 – Extended Edition
ビデオ視聴済A Tour of SwiftUI