Update examples to Swift 5
This commit is contained in:
@@ -32,9 +32,9 @@ do {
|
|||||||
transmitRate: .baud9600,
|
transmitRate: .baud9600,
|
||||||
minimumBytesToRead: 1)
|
minimumBytesToRead: 1)
|
||||||
|
|
||||||
print("Writing test string <\(testString)> of \(testString.characters.count) characters to serial port")
|
print("Writing test string <\(testString)> of \(testString.count) characters to serial port")
|
||||||
|
|
||||||
var bytesWritten = try serialPort.writeString(testString)
|
let bytesWritten = try serialPort.writeString(testString)
|
||||||
|
|
||||||
print("Successfully wrote \(bytesWritten) bytes")
|
print("Successfully wrote \(bytesWritten) bytes")
|
||||||
print("Waiting to receive what was written...")
|
print("Waiting to receive what was written...")
|
||||||
@@ -54,7 +54,7 @@ do {
|
|||||||
var multiLineString: String = ""
|
var multiLineString: String = ""
|
||||||
|
|
||||||
|
|
||||||
for i in 1...numberOfMultiNewLineTest {
|
for _ in 1...numberOfMultiNewLineTest {
|
||||||
multiLineString += testString + "\n"
|
multiLineString += testString + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ do {
|
|||||||
|
|
||||||
|
|
||||||
while true {
|
while true {
|
||||||
var enteredKey = getKeyPress()
|
let enteredKey = getKeyPress()
|
||||||
printToScreenFrom(myself: true, characterToPrint: enteredKey)
|
printToScreenFrom(myself: true, characterToPrint: enteredKey)
|
||||||
var _ = try serialPort.writeChar(enteredKey)
|
var _ = try serialPort.writeChar(enteredKey)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user