From de4f742388002e5b8307903369727300dd3e6049 Mon Sep 17 00:00:00 2001
From: Arturs Artamonovs <arturs.artamonovs@protonmail.com>
Date: Wed, 12 Jun 2024 08:06:30 +0100
Subject: Add MapKit demo code

---
 .../AccentColor.colorset/Contents.json             |  11 ++
 .../AppIcon.appiconset/Contents.json               |  58 ++++++++++
 LearnMapKit/Assets.xcassets/Contents.json          |   6 ++
 LearnMapKit/ContentView.swift                      | 119 +++++++++++++++++++++
 LearnMapKit/LearnMapKit.entitlements               |  10 ++
 LearnMapKit/LearnMapKitApp.swift                   |  17 +++
 .../Preview Assets.xcassets/Contents.json          |   6 ++
 7 files changed, 227 insertions(+)
 create mode 100644 LearnMapKit/Assets.xcassets/AccentColor.colorset/Contents.json
 create mode 100644 LearnMapKit/Assets.xcassets/AppIcon.appiconset/Contents.json
 create mode 100644 LearnMapKit/Assets.xcassets/Contents.json
 create mode 100644 LearnMapKit/ContentView.swift
 create mode 100644 LearnMapKit/LearnMapKit.entitlements
 create mode 100644 LearnMapKit/LearnMapKitApp.swift
 create mode 100644 LearnMapKit/Preview Content/Preview Assets.xcassets/Contents.json

(limited to 'LearnMapKit')

diff --git a/LearnMapKit/Assets.xcassets/AccentColor.colorset/Contents.json b/LearnMapKit/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..eb87897
--- /dev/null
+++ b/LearnMapKit/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+  "colors" : [
+    {
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/LearnMapKit/Assets.xcassets/AppIcon.appiconset/Contents.json b/LearnMapKit/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..3f00db4
--- /dev/null
+++ b/LearnMapKit/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,58 @@
+{
+  "images" : [
+    {
+      "idiom" : "mac",
+      "scale" : "1x",
+      "size" : "16x16"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "2x",
+      "size" : "16x16"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "1x",
+      "size" : "32x32"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "2x",
+      "size" : "32x32"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "1x",
+      "size" : "128x128"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "2x",
+      "size" : "128x128"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "1x",
+      "size" : "256x256"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "2x",
+      "size" : "256x256"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "1x",
+      "size" : "512x512"
+    },
+    {
+      "idiom" : "mac",
+      "scale" : "2x",
+      "size" : "512x512"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/LearnMapKit/Assets.xcassets/Contents.json b/LearnMapKit/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/LearnMapKit/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/LearnMapKit/ContentView.swift b/LearnMapKit/ContentView.swift
new file mode 100644
index 0000000..d9e3377
--- /dev/null
+++ b/LearnMapKit/ContentView.swift
@@ -0,0 +1,119 @@
+//
+//  ContentView.swift
+//  LearnMapKit
+//
+//  Created by Jacky Jack on 05/06/2024.
+//
+
+import SwiftUI
+import MapKit
+
+struct ContentView: View {
+    
+    
+    @State private var region = MKCoordinateRegion()
+    
+    let initialPosition: MapCameraPosition = {
+        let center = CLLocationCoordinate2D(latitude: 55.90159, longitude:-3.53154)
+        let span = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1)
+        let region = MKCoordinateRegion(center: center, span: span)
+        return .region(region)
+    }()
+    
+    let position1 = CLLocationCoordinate2D(latitude: 55.80159, longitude:-3.53154)
+    let position2 = CLLocationCoordinate2D(latitude: 55.99159, longitude:-3.53154)
+    let position3 = CLLocationCoordinate2D(latitude: 55.80159, longitude:-3.43154)
+    let position4 = CLLocationCoordinate2D(latitude: 55.80159, longitude:-3.63154)
+    
+    var body: some View {
+        
+        VStack {
+            HStack(alignment: .top) {
+                Button("1") {
+                    print("Pressed 1")
+                }
+                Button("2") {
+                    print("Pressed 2")
+                }
+                Button("3") {
+                    print("Pressed 3")
+                }
+                Button("4") {
+                    print("Pressed 4")
+                }
+                Button("5") {
+                    print("Pressed 5")
+                }
+                Button("6") {
+                    print("Pressed 6")
+                }
+                Button("7") {
+                    print("Pressed 7")
+                }
+            }
+            .border(.blue)
+            //.frame(maxWidth:.infinity)
+            //.padding()
+            
+            Map(initialPosition: initialPosition) {
+                Annotation("plane1", coordinate: position1) {
+                    ZStack {
+                        RoundedRectangle(cornerRadius: 10)
+                            .fill(.background)
+                        RoundedRectangle(cornerRadius: 10)
+                            .stroke(.secondary,lineWidth: 5)
+                        Image(systemName:"airplane.circle.fill")
+                            .resizable()
+                            .frame(width:20,height: 20)
+                    }
+                }.annotationTitles(.hidden)
+                Annotation("plane2", coordinate: position2) {
+                    ZStack {
+                        RoundedRectangle(cornerRadius: 10)
+                            .fill(.background)
+                        RoundedRectangle(cornerRadius: 10)
+                            .stroke(.secondary,lineWidth: 5)
+                        Image(systemName:"airplane.circle.fill")
+                            .resizable()
+                            .frame(width:20,height: 20)
+                    }
+                }.annotationTitles(.hidden)
+                Annotation("plane3", coordinate: position3) {
+                    ZStack {
+                        RoundedRectangle(cornerRadius: 10)
+                            .fill(.background)
+                        RoundedRectangle(cornerRadius: 10)
+                            .stroke(.secondary,lineWidth: 5)
+                        Image(systemName:"airplane.circle.fill")
+                            .resizable()
+                            .frame(width:20,height: 20)
+                    }
+                }.annotationTitles(.hidden)
+                Annotation("plane4", coordinate: position4) {
+                    ZStack {
+                        RoundedRectangle(cornerRadius: 10)
+                            .fill(.background)
+                        RoundedRectangle(cornerRadius: 10)
+                            .stroke(.secondary,lineWidth: 5)
+                        Image(systemName:"airplane.circle.fill")
+                            .resizable()
+                            .frame(width:20,height: 20)
+                    }
+                }.annotationTitles(.hidden)
+            }
+            .padding()
+            .border(.green)
+            .layoutPriority(1)
+            .mapStyle(.hybrid(elevation: .realistic))
+            
+            
+        }
+        .padding()
+        .border(.red)
+        .layoutPriority(1)
+    }
+}
+
+#Preview {
+    ContentView()
+}
diff --git a/LearnMapKit/LearnMapKit.entitlements b/LearnMapKit/LearnMapKit.entitlements
new file mode 100644
index 0000000..18aff0c
--- /dev/null
+++ b/LearnMapKit/LearnMapKit.entitlements
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>com.apple.security.app-sandbox</key>
+	<true/>
+	<key>com.apple.security.files.user-selected.read-only</key>
+	<true/>
+</dict>
+</plist>
diff --git a/LearnMapKit/LearnMapKitApp.swift b/LearnMapKit/LearnMapKitApp.swift
new file mode 100644
index 0000000..eebb4b8
--- /dev/null
+++ b/LearnMapKit/LearnMapKitApp.swift
@@ -0,0 +1,17 @@
+//
+//  LearnMapKitApp.swift
+//  LearnMapKit
+//
+//  Created by Jacky Jack on 05/06/2024.
+//
+
+import SwiftUI
+
+@main
+struct LearnMapKitApp: App {
+    var body: some Scene {
+        WindowGroup {
+            ContentView()
+        }
+    }
+}
diff --git a/LearnMapKit/Preview Content/Preview Assets.xcassets/Contents.json b/LearnMapKit/Preview Content/Preview Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/LearnMapKit/Preview Content/Preview Assets.xcassets/Contents.json	
@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
-- 
cgit v1.2.3