Skip to content

Commit 91f751f

Browse files
committed
Skip unwrapping for performance
1 parent 88b2230 commit 91f751f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Sources/GateEngine/Game.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public final class Game {
182182

183183
extension Game {
184184
@MainActor
185-
@usableFromInline
186-
static var shared: Game! = nil
185+
internal static var _shared: Game! = nil
186+
@MainActor
187+
public static var shared: Game {
188+
return _shared.unsafelyUnwrapped
189+
}
187190
}

Sources/GateEngine/GameDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ extension GameDelegate {
159159
@MainActor public static func main() {
160160
let delegate = Self()
161161
let platform = CurrentPlatform(delegate: delegate)
162-
Game.shared = Game(delegate: delegate, currentPlatform: platform)
162+
Game._shared = Game(delegate: delegate, currentPlatform: platform)
163163
Game.shared.platform.main()
164164
}
165165
}

0 commit comments

Comments
 (0)