Skip to content

Commit 3623b36

Browse files
Use os_log instead of print
1 parent 4d8a19f commit 3623b36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tictactoe Shared/GameScene.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import SpriteKit
23
#if os(iOS)
34
import UIKit
@@ -62,7 +63,7 @@ class GameScene: SKScene {
6263

6364
class func newGameScene(boardSize: Int = 3) -> GameScene {
6465
guard let scene = SKScene(fileNamed: "GameScene") as? GameScene else {
65-
print("Failed to load GameScene.sks")
66+
os_log("Failed to load GameScene.sks")
6667
abort()
6768
}
6869
scene.boardSize = boardSize
@@ -207,15 +208,15 @@ class GameScene: SKScene {
207208
}
208209

209210
if let winningPattern = winningPatterns.first(where: { (currentPlayer == .x ? xBoard : oBoard) & $0 == $0 }) {
210-
print("Player \(currentPlayer.rawValue) wins!")
211+
os_log("Player \(self.currentPlayer.rawValue) wins!")
211212
gameState = .won // Update the game state to won
212213
drawWinningLine(for: winningPattern)
213214
let delayAction = SKAction.wait(forDuration: 5.0)
214215
run(delayAction) {
215216
self.resetBoard()
216217
}
217218
} else if checkDraw() {
218-
print("It's a draw!")
219+
os_log("It's a draw!")
219220
gameState = .draw // Update the game state to draw
220221
let delayAction = SKAction.wait(forDuration: 5.0)
221222
run(delayAction) {

0 commit comments

Comments
 (0)