From b35cd8f180f19ef531d0822a36270d4632a93b4d Mon Sep 17 00:00:00 2001 From: Andy Liu Date: Thu, 26 Sep 2024 13:31:59 +0800 Subject: [PATCH] Update for Embedded Swift Signed-off-by: Andy Liu --- .../13MoreProjects/Pong/Sources/Pong/Game.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Examples/SwiftIOPlayground/13MoreProjects/Pong/Sources/Pong/Game.swift b/Examples/SwiftIOPlayground/13MoreProjects/Pong/Sources/Pong/Game.swift index 40c368d..70146a3 100644 --- a/Examples/SwiftIOPlayground/13MoreProjects/Pong/Sources/Pong/Game.swift +++ b/Examples/SwiftIOPlayground/13MoreProjects/Pong/Sources/Pong/Game.swift @@ -111,7 +111,7 @@ struct PongGame { ball.updateAfterHitWall(window: window) speaker.write(hitWallSound) } - print(ball.x, ball.y) + print("\(ball.x), \(ball.y)") // If the ball hits left/right paddle, change the ball's // direction to bounce it in an opposite direction. @@ -189,8 +189,8 @@ struct PongGame { let size = try file.tell() - headerSize buffer = [UInt8](repeating: 0, count: size) - try buffer.withUnsafeMutableBytes { rawBuffer in - _ = try file.read(fromAbsoluteOffest: headerSize, into: rawBuffer, count: size) + buffer.withUnsafeMutableBytes { rawBuffer in + _ = try? file.read(fromAbsoluteOffest: headerSize, into: rawBuffer, count: size) } try file.close() } catch {