Skip to content

Commit 141ddb4

Browse files
committed
fix: fix the access levels
1 parent ffc63a0 commit 141ddb4

File tree

5 files changed

+46
-44
lines changed

5 files changed

+46
-44
lines changed

Sources/OpenSwiftUI/App Structure/App Organization/Supporting types/Application.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import OpenGLFW
33
import OpenSpatial
44

55
/// An object that manages an app’s main event loop and resources used by all of that app’s objects.
6-
@MainActor package class Application {
6+
@MainActor class Application {
77

8-
package var globalEnvironmentValues = EnvironmentValues()
8+
var globalEnvironmentValues = EnvironmentValues()
99

1010
// MARK: - Getting the shared app object
1111

1212
/// Accessing the shared application
13-
package static let shared = Application()
13+
static let shared = Application()
1414

15-
package var appGraph: GraphHost? = nil
15+
var appGraph: GraphHost? = nil
1616

1717
// MARK: - Managing the event loop
1818

1919
/// A Boolean value indicating whether the main event loop is running.
20-
package var isRunning: Bool = false
20+
var isRunning: Bool = false
2121

2222
/// Starts the main event loop.
23-
package func run<T: App>(_ app: T) {
23+
func run<T: App>(_ app: T) {
2424
print("\(Self.self).\(#function)")
2525

2626
guard glfwInit() == GLFW_TRUE else {
@@ -65,7 +65,7 @@ import OpenSpatial
6565
// MARK: - Terminating the app
6666

6767
/// Terminates the receiver.
68-
package func terminate(_ sender: Any?) {
68+
func terminate(_ sender: Any?) {
6969
isRunning = false
7070
}
7171
}

Sources/OpenSwiftUI/Framework Integration/Windows and Linux/AppGraph.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@ import OpenCombine
33
import OpenSpatial
44

55
/// A graph host for an app.
6-
package final class AppGraph<AppType: App> : GraphHost {
6+
@MainActor
7+
class AppGraph<AppType: App> : GraphHost {
78

89
/// The app instance.
9-
package let app: AppType
10+
let app: AppType
1011

1112
/// The environment values for the app.
12-
package var environmentValues: EnvironmentValues
13+
let environmentValues: EnvironmentValues
1314

1415
// /// The root scene graph for the app (built from `app.body`).
1516
// package private(set) var sceneGraph: SceneGraph? = nil
1617

1718
/// Creates an app graph with the given value.
1819
///
1920
/// - Parameter value: The value of the app graph.
20-
package init(_ app: AppType, environmentValues: EnvironmentValues) {
21+
init(_ app: AppType, environmentValues: EnvironmentValues) {
2122
self.app = app
2223
self.environmentValues = environmentValues
2324
super.init()
2425

2526
self.mount()
2627
}
2728

28-
override package func mount() {
29+
override func mount() {
2930
var inputs = _SceneInputs()
3031
inputs.environmentValues = environmentValues
3132

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import Foundation
22

33
/// A graph host.
4-
package class GraphHost {
4+
@MainActor class GraphHost {
55

66
/// The parent of the graph host.
7-
package weak var parent: GraphHost? = nil
7+
weak var parent: GraphHost? = nil
88

99
/// The children of the graph host.
10-
package var children: [GraphHost] = []
10+
var children: [GraphHost] = []
1111

12-
@inlinable package func appendChild(_ child: GraphHost) {
12+
func appendChild(_ child: GraphHost) {
1313
child.parent = self
1414
children.append(child)
1515
}
1616

17-
package func mount() {
17+
func mount() {
1818
}
1919

20-
package func unmount() {
20+
func unmount() {
2121
}
2222

23-
package func update() {
23+
func update() {
2424
}
2525
}

Sources/OpenSwiftUI/Framework Integration/Windows and Linux/SceneGraph.swift

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,43 @@ import OpenCombine
33
import OpenSpatial
44

55
/// A graph host for a scene.
6-
package final class SceneGraph : GraphHost {
6+
@MainActor
7+
class SceneGraph : GraphHost {
78

89
// MARK: - Represented object
910

1011
/// The scene outputs snapshot for this node.
11-
package private(set) var outputs: _SceneOutputs
12+
private(set) var outputs: _SceneOutputs
1213

1314
// MARK : - Window Associated objects
1415

1516
/// Runtime window for renderable scenes (e.g. `Window`).
16-
package private(set) var window: _Window? = nil
17+
private(set) var window: _Window? = nil
1718

1819
// MARK: - Runtime Associated objects
1920

2021
/// The environment values for the scene.
21-
package var environmentValues: EnvironmentValues
22+
var environmentValues: EnvironmentValues
2223

2324
/// Whether this scene is the main scene.
24-
package var isMain: Bool = false
25+
var isMain: Bool = false
2526

2627
/// The title of the scene.
27-
package var title: PassthroughSubject<String, Never> = PassthroughSubject<String, Never>()
28+
var title: PassthroughSubject<String, Never> = PassthroughSubject<String, Never>()
2829

2930
/// The phase of the scene.
30-
package var scenePhase: PassthroughSubject<ScenePhase, Never> = PassthroughSubject<ScenePhase, Never>()
31+
var scenePhase: PassthroughSubject<ScenePhase, Never> = PassthroughSubject<ScenePhase, Never>()
3132

3233
/// The runtime subscriptions for this node.
33-
private var cancellables: Set<AnyCancellable> = []
34+
var cancellables: Set<AnyCancellable> = []
3435

3536
/// The runtime view graph for this scene's root view.
36-
@MainActor package private(set) var viewGraph: ViewGraph? = nil
37+
private(set) var viewGraph: ViewGraph? = nil
3738

3839
/// Creates a scene graph with the given outputs.
3940
///
4041
/// - Parameter outputs: The outputs of the scene.
41-
package init(outputs: _SceneOutputs) {
42+
init(outputs: _SceneOutputs) {
4243
self.outputs = outputs
4344
self.environmentValues = outputs.environmentValues
4445

@@ -61,7 +62,7 @@ package final class SceneGraph : GraphHost {
6162
// MARK: - Runtime lifecycle
6263

6364
/// Creates runtime objects for this scene node and its descendants.
64-
@MainActor package func mountRuntime() {
65+
func mountRuntime() {
6566
if let content = outputs.content {
6667
// Create window from scene outputs (runtime lives in the graph, not in outputs).
6768
let title = outputs.title ?? String(describing: outputs.type)
@@ -88,7 +89,7 @@ package final class SceneGraph : GraphHost {
8889
}
8990
}
9091

91-
@MainActor package func unmountRuntime() {
92+
func unmountRuntime() {
9293
cancellables.removeAll()
9394
if let w = window {
9495
w.destroy()
@@ -101,7 +102,7 @@ package final class SceneGraph : GraphHost {
101102
}
102103
}
103104

104-
override package func mount() {
105+
override func mount() {
105106
let window = _Window(frame: Rect3D(center: Point3D.zero, size: Size3D(width: 900, height: 450, depth: 0)), title: "\(Self.self)")
106107
self.window = window
107108
window.delegate = self
@@ -116,7 +117,7 @@ package final class SceneGraph : GraphHost {
116117
/// Reconciles this node with a new `_SceneOutputs` snapshot.
117118
///
118119
/// Identity is based on `outputs.id`. For nodes without stable IDs, this will recreate.
119-
@MainActor package func reconcile(newOutputs: _SceneOutputs) {
120+
func reconcile(newOutputs: _SceneOutputs) {
120121
let oldHadWindow = (outputs.content != nil)
121122
let newHasWindow = (newOutputs.content != nil)
122123

@@ -186,15 +187,15 @@ package final class SceneGraph : GraphHost {
186187

187188
// MARK: - Queries
188189

189-
@MainActor package func firstWindow() -> _Window? {
190+
func firstWindow() -> _Window? {
190191
if let w = window { return w }
191192
for child in children {
192193
if let w = (child as? SceneGraph)?.firstWindow() { return w }
193194
}
194195
return nil
195196
}
196197

197-
@MainActor package func collectWindowScenes(into result: inout [SceneGraph]) {
198+
func collectWindowScenes(into result: inout [SceneGraph]) {
198199
if window != nil {
199200
result.append(self)
200201
}
@@ -204,7 +205,7 @@ package final class SceneGraph : GraphHost {
204205
}
205206
}
206207

207-
extension SceneGraph : CustomStringConvertible {
208+
extension SceneGraph : @MainActor CustomStringConvertible {
208209
package var description: String {
209210
"""
210211
- SceneGraph<outputs: \(outputs.type)>
@@ -214,7 +215,7 @@ extension SceneGraph : CustomStringConvertible {
214215
}
215216
}
216217

217-
extension SceneGraph : WindowDelegate {
218+
extension SceneGraph : @MainActor WindowDelegate {
218219

219220
/// Tells the delegate that the window is about to be minimized.
220221
package func windowWillMiniaturize(_ window: _Window) {

Sources/OpenSwiftUI/Framework Integration/Windows and Linux/ViewGraph.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import Foundation
22

33
/// A graph host for a view.
4-
package final class ViewGraph : GraphHost {
4+
class ViewGraph : GraphHost {
55

66
/// The last built outputs snapshot.
7-
package private(set) var outputs: _ViewOutputs
7+
private(set) var outputs: _ViewOutputs
88

99
/// Whether this view graph needs to be re-built/re-rendered.
10-
package var isDirty: Bool = true
10+
var isDirty: Bool = true
1111

12-
package init(outputs: _ViewOutputs) {
12+
init(outputs: _ViewOutputs) {
1313
self.outputs = outputs
1414
}
1515

16-
package func markDirty() {
16+
func markDirty() {
1717
isDirty = true
1818
}
1919

20-
package func clearDirty() {
20+
func clearDirty() {
2121
isDirty = false
2222
}
2323

24-
package func updateOutputs(_ newOutputs: _ViewOutputs) {
24+
func updateOutputs(_ newOutputs: _ViewOutputs) {
2525
outputs = newOutputs
2626
markDirty()
2727
}

0 commit comments

Comments
 (0)