Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Remove pointer type
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Sep 29, 2024
1 parent bd6c9d6 commit cd4e4df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 45 deletions.
8 changes: 8 additions & 0 deletions Sources/Model/Extensions/OpaquePointer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// OpaquePointer.swift
// Meta
//
// Created by david-swift on 29.09.24.
//

extension OpaquePointer: @retroactive @unchecked Sendable { }
4 changes: 2 additions & 2 deletions Sources/Model/User Interface/Scene/SceneStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public actor SceneStorage {
public var previousState: SceneElement?

/// The pointer as an opaque pointer, as this may be needed with backends interoperating with C or C++.
public var opaquePointer: Pointer? {
public var opaquePointer: OpaquePointer? {
get {
pointer as? Pointer
pointer as? OpaquePointer
}
set {
pointer = newValue
Expand Down
30 changes: 0 additions & 30 deletions Sources/Model/User Interface/View/Pointer/Pointer.swift

This file was deleted.

16 changes: 3 additions & 13 deletions Sources/Model/User Interface/View/ViewStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,13 @@ public actor ViewStorage: Sendable {
/// The previous state of the widget.
public var previousState: Widget?

/// The pointer as an actual pointer, e.g. for interoperating with C or C++.
public var actualPointer: Pointer? {
get {
pointer as? Pointer
}
set {
pointer = newValue
}
}

/// The pointer as an opaque pointer, as this is needed with backends interoperating with C or C++.
public var opaquePointer: OpaquePointer? {
get {
actualPointer?.opaquePointer
pointer as? OpaquePointer
}
set {
actualPointer?.opaquePointer = newValue
pointer = newValue
}
}

Expand All @@ -64,7 +54,7 @@ public actor ViewStorage: Sendable {
content: [String: [ViewStorage]] = [:],
state: Widget? = nil
) {
self.pointer = Pointer(pointer)
self.pointer = pointer
self.content = content
self.previousState = state
}
Expand Down

0 comments on commit cd4e4df

Please sign in to comment.