summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LearnMapKit/Assets.xcassets/AccentColor.colorset/Contents.json11
-rw-r--r--LearnMapKit/Assets.xcassets/AppIcon.appiconset/Contents.json58
-rw-r--r--LearnMapKit/Assets.xcassets/Contents.json6
-rw-r--r--LearnMapKit/ContentView.swift119
-rw-r--r--LearnMapKit/LearnMapKit.entitlements10
-rw-r--r--LearnMapKit/LearnMapKitApp.swift17
-rw-r--r--LearnMapKit/Preview Content/Preview Assets.xcassets/Contents.json6
-rw-r--r--LearnMapKitTests/LearnMapKitTests.swift36
-rw-r--r--LearnMapKitUITests/LearnMapKitUITests.swift41
-rw-r--r--LearnMapKitUITests/LearnMapKitUITestsLaunchTests.swift32
10 files changed, 336 insertions, 0 deletions
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
+ }
+}
diff --git a/LearnMapKitTests/LearnMapKitTests.swift b/LearnMapKitTests/LearnMapKitTests.swift
new file mode 100644
index 0000000..ef6bc2e
--- /dev/null
+++ b/LearnMapKitTests/LearnMapKitTests.swift
@@ -0,0 +1,36 @@
+//
+// LearnMapKitTests.swift
+// LearnMapKitTests
+//
+// Created by Jacky Jack on 05/06/2024.
+//
+
+import XCTest
+@testable import LearnMapKit
+
+final class LearnMapKitTests: XCTestCase {
+
+ override func setUpWithError() throws {
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+ }
+
+ override func tearDownWithError() throws {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ }
+
+ func testExample() throws {
+ // This is an example of a functional test case.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+ // Any test you write for XCTest can be annotated as throws and async.
+ // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
+ // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
+ }
+
+ func testPerformanceExample() throws {
+ // This is an example of a performance test case.
+ self.measure {
+ // Put the code you want to measure the time of here.
+ }
+ }
+
+}
diff --git a/LearnMapKitUITests/LearnMapKitUITests.swift b/LearnMapKitUITests/LearnMapKitUITests.swift
new file mode 100644
index 0000000..43cb206
--- /dev/null
+++ b/LearnMapKitUITests/LearnMapKitUITests.swift
@@ -0,0 +1,41 @@
+//
+// LearnMapKitUITests.swift
+// LearnMapKitUITests
+//
+// Created by Jacky Jack on 05/06/2024.
+//
+
+import XCTest
+
+final class LearnMapKitUITests: XCTestCase {
+
+ override func setUpWithError() throws {
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+
+ // In UI tests it is usually best to stop immediately when a failure occurs.
+ continueAfterFailure = false
+
+ // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
+ }
+
+ override func tearDownWithError() throws {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ }
+
+ func testExample() throws {
+ // UI tests must launch the application that they test.
+ let app = XCUIApplication()
+ app.launch()
+
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+ }
+
+ func testLaunchPerformance() throws {
+ if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
+ // This measures how long it takes to launch your application.
+ measure(metrics: [XCTApplicationLaunchMetric()]) {
+ XCUIApplication().launch()
+ }
+ }
+ }
+}
diff --git a/LearnMapKitUITests/LearnMapKitUITestsLaunchTests.swift b/LearnMapKitUITests/LearnMapKitUITestsLaunchTests.swift
new file mode 100644
index 0000000..021d9d7
--- /dev/null
+++ b/LearnMapKitUITests/LearnMapKitUITestsLaunchTests.swift
@@ -0,0 +1,32 @@
+//
+// LearnMapKitUITestsLaunchTests.swift
+// LearnMapKitUITests
+//
+// Created by Jacky Jack on 05/06/2024.
+//
+
+import XCTest
+
+final class LearnMapKitUITestsLaunchTests: XCTestCase {
+
+ override class var runsForEachTargetApplicationUIConfiguration: Bool {
+ true
+ }
+
+ override func setUpWithError() throws {
+ continueAfterFailure = false
+ }
+
+ func testLaunch() throws {
+ let app = XCUIApplication()
+ app.launch()
+
+ // Insert steps here to perform after app launch but before taking a screenshot,
+ // such as logging into a test account or navigating somewhere in the app
+
+ let attachment = XCTAttachment(screenshot: app.screenshot())
+ attachment.name = "Launch Screen"
+ attachment.lifetime = .keepAlways
+ add(attachment)
+ }
+}