mirror of
https://github.com/seemoo-lab/openhaystack.git
synced 2026-03-02 09:10:20 +00:00
* Moving microbit firmware to a subfolder in /Firmware to prepare integration of ESP32 * Add firmware for ESP32 and update workflows * Integrated ESP32 firmware from @fhessel to OpenHaystack App Co-authored-by: Frank Hessel <fhessel@seemoo.tu-darmstadt.de>
31 lines
897 B
Swift
31 lines
897 B
Swift
//
|
|
// AccessoryMapView.swift
|
|
// OpenHaystack
|
|
//
|
|
// Created by Alex - SEEMOO on 02.03.21.
|
|
// Copyright © 2021 SEEMOO - TU Darmstadt. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import MapKit
|
|
import SwiftUI
|
|
|
|
struct AccessoryMapView: NSViewControllerRepresentable {
|
|
@ObservedObject var accessoryController: AccessoryController
|
|
@Binding var mapType: MKMapType
|
|
var focusedAccessory: Accessory?
|
|
|
|
func makeNSViewController(context: Context) -> MapViewController {
|
|
return MapViewController(nibName: NSNib.Name("MapViewController"), bundle: nil)
|
|
}
|
|
|
|
func updateNSViewController(_ nsViewController: MapViewController, context: Context) {
|
|
let accessories = self.accessoryController.accessories
|
|
|
|
nsViewController.zoom(on: focusedAccessory)
|
|
nsViewController.addLastLocations(from: accessories)
|
|
|
|
nsViewController.changeMapType(mapType)
|
|
}
|
|
}
|