diff --git a/Examples/SwiftIOPlayground/08LCD/AccelerationVisualizer/Sources/Bar.swift b/Examples/SwiftIOPlayground/08LCD/AccelerationVisualizer/Sources/Bar.swift index b2e5bc5..a2c603f 100644 --- a/Examples/SwiftIOPlayground/08LCD/AccelerationVisualizer/Sources/Bar.swift +++ b/Examples/SwiftIOPlayground/08LCD/AccelerationVisualizer/Sources/Bar.swift @@ -21,9 +21,7 @@ struct Bar { x = (screen.width - width) / 2 let data = [UInt16](repeating: color, count: width * height) - data.withUnsafeBytes { - screen.writeBitmap(x: x, y: y, width: width, height: height, data: $0) - } + screen.writeBitmap(x: x, y: y, width: width, height: height, data: data) } // Update indicator's position in the bar with the latest value. diff --git a/Examples/SwiftIOPlayground/08LCD/AnalogVisualizer/Sources/main.swift b/Examples/SwiftIOPlayground/08LCD/AnalogVisualizer/Sources/main.swift index 6e85318..fc3338c 100644 --- a/Examples/SwiftIOPlayground/08LCD/AnalogVisualizer/Sources/main.swift +++ b/Examples/SwiftIOPlayground/08LCD/AnalogVisualizer/Sources/main.swift @@ -55,7 +55,5 @@ while true { // Draw a vertical line on the screen. func drawLine(x: Int, y: Int, height: Int, color: UInt16) { let buffer = [UInt16](repeating: color, count: height) - buffer.withUnsafeBytes { - screen.writeBitmap(x: x, y: y, width: 1, height: height, data: $0) - } + screen.writeBitmap(x: x, y: y, width: 1, height: height, data: buffer) } \ No newline at end of file diff --git a/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift b/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift index 0de2c9e..e4aedca 100644 --- a/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift +++ b/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift @@ -38,9 +38,7 @@ while true { // Send the data to the screen using SPI to update the specified area. let x = screen.width - i * scrollStep - 1 - buffer.withUnsafeBytes { - screen.writeBitmap(x: x, y: 0, width: scrollStep, height: screen.height, data: $0) - } + screen.writeBitmap(x: x, y: 0, width: scrollStep, height: screen.height, data: buffer) sleep(ms: 30) } diff --git a/Examples/SwiftIOPlayground/12MoreProjects/FallingSand/Sources/Sand.swift b/Examples/SwiftIOPlayground/12MoreProjects/FallingSand/Sources/Sand.swift index c20faa1..626310e 100644 --- a/Examples/SwiftIOPlayground/12MoreProjects/FallingSand/Sources/Sand.swift +++ b/Examples/SwiftIOPlayground/12MoreProjects/FallingSand/Sources/Sand.swift @@ -175,9 +175,7 @@ extension ST7789 { } } - buffer.withUnsafeBytes { - screen.writeBitmap(x: point.x, y: point.y, width: width, height: height, data: $0) - } + screen.writeBitmap(x: point.x, y: point.y, width: width, height: height, data: buffer) } func drawEmptyRect(at point: Point, width: Int, height: Int, stroke: Int, color: UInt16) { diff --git a/Examples/SwiftIOPlayground/12MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift b/Examples/SwiftIOPlayground/12MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift index 23a9c62..c10be41 100644 --- a/Examples/SwiftIOPlayground/12MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift +++ b/Examples/SwiftIOPlayground/12MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift @@ -133,9 +133,7 @@ public struct MovingBall { } } - buffer.withUnsafeBytes { - screen.writeBitmap(x: x0, y: y0, width: x1 - x0, height: y1 - y0, data: $0) - } + screen.writeBitmap(x: x0, y: y0, width: x1 - x0, height: y1 - y0, data: buffer) } } } \ No newline at end of file diff --git a/Examples/SwiftIOPlayground/12MoreProjects/Pong/Sources/Pong/Game.swift b/Examples/SwiftIOPlayground/12MoreProjects/Pong/Sources/Pong/Game.swift index 9e19337..40c368d 100644 --- a/Examples/SwiftIOPlayground/12MoreProjects/Pong/Sources/Pong/Game.swift +++ b/Examples/SwiftIOPlayground/12MoreProjects/Pong/Sources/Pong/Game.swift @@ -525,8 +525,6 @@ extension ST7789 { } } - buffer.withUnsafeBytes { ptr in - writeBitmap(x: x0, y: y0, width: x1 - x0, height: y1 - y0, data: ptr) - } + writeBitmap(x: x0, y: y0, width: x1 - x0, height: y1 - y0, data: buffer) } } diff --git a/Examples/SwiftIOPlayground/12MoreProjects/TicTacToe/Sources/TicTacToe/Game.swift b/Examples/SwiftIOPlayground/12MoreProjects/TicTacToe/Sources/TicTacToe/Game.swift index 6416021..88eef22 100644 --- a/Examples/SwiftIOPlayground/12MoreProjects/TicTacToe/Sources/TicTacToe/Game.swift +++ b/Examples/SwiftIOPlayground/12MoreProjects/TicTacToe/Sources/TicTacToe/Game.swift @@ -303,14 +303,12 @@ struct TicTacToeView { } } - buffer.withUnsafeBytes { - screen.writeBitmap( - x: pos.x * gridWidth + gridStroke, - y: pos.y * gridHeight + gridStroke, - width: gridInternalWidth, - height: gridInternalHeight, - data: $0) - } + screen.writeBitmap( + x: pos.x * gridWidth + gridStroke, + y: pos.y * gridHeight + gridStroke, + width: gridInternalWidth, + height: gridInternalHeight, + data: buffer) } // Draw an empty rectangle at a specified position. @@ -329,14 +327,12 @@ struct TicTacToeView { } } - buffer.withUnsafeBytes { - screen.writeBitmap( - x: pos.x * gridWidth + gridStroke, - y: pos.y * gridHeight + gridStroke, - width: gridInternalWidth, - height: gridInternalHeight, - data: $0) - } + screen.writeBitmap( + x: pos.x * gridWidth + gridStroke, + y: pos.y * gridHeight + gridStroke, + width: gridInternalWidth, + height: gridInternalHeight, + data: buffer) } private func drawBackground() {