diff --git a/Issue Manager/Back End/Objects/Base/ObjectMeta.swift b/Issue Manager/Back End/Objects/Base/ObjectMeta.swift index 6c8ad71..75c7cbf 100644 --- a/Issue Manager/Back End/Objects/Base/ObjectMeta.swift +++ b/Issue Manager/Back End/Objects/Base/ObjectMeta.swift @@ -3,7 +3,7 @@ import Foundation import GRDB -struct ObjectMeta: AnyObjectMeta, Codable, Equatable { +struct ObjectMeta: Codable, Equatable { var id = Object.ID() var lastChangeTime = Date.distantPast // intentionally wrong to not throw off most recent lastChangeTime for sync var isDeleted = false @@ -20,9 +20,3 @@ extension ObjectMeta: DBRecord where Object: DBRecord { case isDeleted } } - -protocol AnyObjectMeta { - var rawID: String { get } - var lastChangeTime: Date { get } - var isDeleted: Bool { get } -} diff --git a/Issue Manager/Back End/Objects/Base/StoredObject.swift b/Issue Manager/Back End/Objects/Base/StoredObject.swift index d8b2485..777cc8c 100644 --- a/Issue Manager/Back End/Objects/Base/StoredObject.swift +++ b/Issue Manager/Back End/Objects/Base/StoredObject.swift @@ -3,7 +3,7 @@ import Foundation import GRDB -protocol StoredObject: AnyStoredObject { +protocol StoredObject: DBRecord, Sendable { typealias ID = ObjectID typealias Meta = ObjectMeta @@ -26,7 +26,6 @@ extension StoredObject { var id: ID { meta.id } - var rawMeta: AnyObjectMeta { meta } var rawID: String { id.rawValue } var isDeleted: Bool { meta.isDeleted } } @@ -37,10 +36,6 @@ extension DerivableRequest where RowDecoder: StoredObject { } } -protocol AnyStoredObject: DBRecord, Sendable { - var rawID: String { get } -} - // pure value types: of course they're sendable extension QueryInterfaceRequest: @unchecked Sendable {} extension BelongsToAssociation: @unchecked Sendable {} diff --git a/Issue Manager/Back End/Objects/MapHolder.swift b/Issue Manager/Back End/Objects/MapHolder.swift index 25546b9..519f545 100644 --- a/Issue Manager/Back End/Objects/MapHolder.swift +++ b/Issue Manager/Back End/Objects/MapHolder.swift @@ -3,7 +3,7 @@ import Foundation import GRDB -protocol MapHolder: AnyStoredObject { +protocol MapHolder: StoredObject { var name: String { get } var children: Map.Query { get } var constructionSiteID: ConstructionSite.ID { get } @@ -28,7 +28,7 @@ extension MapHolder { extension DerivableRequest where RowDecoder == Map { @MainActor - func recursiveChildren(of holder: MapHolder) -> Self { + func recursiveChildren(of holder: some MapHolder) -> Self { holder.recursiveChildren(in: self) } } diff --git a/Issue Manager/Issue Manager/Common/IssueBadge.swift b/Issue Manager/Issue Manager/Common/IssueBadge.swift index 4509a6d..86a3daa 100644 --- a/Issue Manager/Issue Manager/Common/IssueBadge.swift +++ b/Issue Manager/Issue Manager/Common/IssueBadge.swift @@ -16,7 +16,7 @@ final class IssueBadge: UIView { } var shouldUseRecursiveIssues = true - var holder: MapHolder! { + var holder: (any MapHolder)! { didSet { update() } } diff --git a/Issue Manager/Issue Manager/Map List/MapListViewController.swift b/Issue Manager/Issue Manager/Map List/MapListViewController.swift index 9fd39f2..f0c635f 100644 --- a/Issue Manager/Issue Manager/Map List/MapListViewController.swift +++ b/Issue Manager/Issue Manager/Map List/MapListViewController.swift @@ -11,7 +11,7 @@ final class MapListViewController: RefreshingTableViewController, InstantiableVi @IBOutlet private var backToSiteListButton: UIBarButtonItem! - var holder: MapHolder! { + var holder: (any MapHolder)! { didSet { update() } } @@ -149,17 +149,18 @@ final class MapListViewController: RefreshingTableViewController, InstantiableVi mapController.holder = holder } } else { - showMapController(for: holder) + let h = holder! // awkward work around for implicit existential opening not opening IUOs + showMapController(for: h) } } - func showMapController(for holder: MapHolder) { + func showMapController(for holder: some MapHolder) { let mapController = MapViewController.instantiate()! mapController.holder = holder show(mapController, sender: self) } - func showListController(for holder: MapHolder) { + func showListController(for holder: some MapHolder) { let listController = MapListViewController.instantiate()! listController.holder = holder show(listController, sender: self) diff --git a/Issue Manager/Issue Manager/Map/MapViewController.swift b/Issue Manager/Issue Manager/Map/MapViewController.swift index be23f02..610f42a 100644 --- a/Issue Manager/Issue Manager/Map/MapViewController.swift +++ b/Issue Manager/Issue Manager/Map/MapViewController.swift @@ -100,7 +100,7 @@ final class MapViewController: UIViewController, InstantiableViewController { var isMovingIssue: Bool { editorForPlacingIssue != nil } private var editorForPlacingIssue: EditIssueViewController? - var holder: MapHolder? { + var holder: (any MapHolder)? { didSet { update() } } var map: Map? { holder as? Map }