diff --git a/src/Catty/BluetoothDevice/FirmataDevices/Arduino/ArduinoHelper.swift b/src/Catty/BluetoothDevice/FirmataDevices/Arduino/ArduinoHelper.swift index 48816a6380..aa35ec7edd 100644 --- a/src/Catty/BluetoothDevice/FirmataDevices/Arduino/ArduinoHelper.swift +++ b/src/Catty/BluetoothDevice/FirmataDevices/Arduino/ArduinoHelper.swift @@ -32,7 +32,7 @@ open class ArduinoHelper { var analogPin4 = 0 var analogPin5 = 0 - var digitalValues: [Int] = [Int](repeating: 0, count: 21) + var digitalValues = [Int](repeating: 0, count: 21) var portValues = Array(repeating: Array(repeating: 0, count: 8), count: 3) //Helper diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Components/CentralManager.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Components/CentralManager.swift index 7ebc964a35..16acd302e6 100644 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Components/CentralManager.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Components/CentralManager.swift @@ -208,7 +208,7 @@ import UIKit open var peripherals: [Peripheral] { - let values: [Peripheral] = [Peripheral](self.ownPeripherals.values) + let values = [Peripheral](self.ownPeripherals.values) return values } diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Components/Peripheral.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Components/Peripheral.swift index 769d4e0560..8669d107fb 100644 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Components/Peripheral.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Components/Peripheral.swift @@ -203,7 +203,7 @@ private func > (lhs: T?, rhs: T?) -> Bool { } open var services: [Service] { - let values: [Service] = [Service](self.ownServices.values) + let values = [Service](self.ownServices.values) return values } diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Components/Service.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Components/Service.swift index 8b8bbfbc2b..4cf5e69d36 100644 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Components/Service.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Components/Service.swift @@ -42,7 +42,7 @@ public final class Service: ServiceWrapper { // MARK: getter public var characteristics: [Characteristic] { - let values: [Characteristic] = [Characteristic](self.ownCharacteristics.values) + let values = [Characteristic](self.ownCharacteristics.values) return values } diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Helper/SimpleFutures.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Helper/SimpleFutures.swift index d4c79f4ac4..d9c38b5cb5 100755 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Helper/SimpleFutures.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Helper/SimpleFutures.swift @@ -920,9 +920,10 @@ open class StreamPromise { // FutureStream open class FutureStream { - private var futures = [Future]() private typealias InFuture = (Future) -> Void - private var saveCompletes = [InFuture]() + + private var saveCompletes = [InFuture]() + private var futures = [Future]() private var capacity: Int? internal let defaultExecutionContext: ExecutionContext = QueueContext.main diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ProfileManager.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ProfileManager.swift index 6608fd8e5a..3562cdd2b4 100755 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ProfileManager.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ProfileManager.swift @@ -34,7 +34,7 @@ open class ProfileManager { // PUBLIC open var services: [ServiceProfile] { - let values: [ServiceProfile] = [ServiceProfile](self.serviceProfiles.values) + let values = [ServiceProfile](self.serviceProfiles.values) return values } diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ServiceProfile.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ServiceProfile.swift index 734b22b3ec..738eaaa63d 100755 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ServiceProfile.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Profiles/ServiceProfile.swift @@ -32,7 +32,7 @@ open class ServiceProfile { public let tag: String open var characteristics: [CharacteristicProfile] { - let values: [CharacteristicProfile] = [CharacteristicProfile](self.characteristicProfiles.values) + let values = [CharacteristicProfile](self.characteristicProfiles.values) return values } diff --git a/src/Catty/BluetoothHelper/BluetoothHelper/Serialize:Deserialize/SerializerDeserializer.swift b/src/Catty/BluetoothHelper/BluetoothHelper/Serialize:Deserialize/SerializerDeserializer.swift index be6d6b0cae..182002d9b9 100755 --- a/src/Catty/BluetoothHelper/BluetoothHelper/Serialize:Deserialize/SerializerDeserializer.swift +++ b/src/Catty/BluetoothHelper/BluetoothHelper/Serialize:Deserialize/SerializerDeserializer.swift @@ -31,21 +31,6 @@ func fromHostByteOrder(_ value: T) -> T { value } -func byteArrayValue(_ value: T) -> [UInt8] { - let values = [value] - let data = values.withUnsafeBytes { Data($0) } - var byteArray = [UInt8](repeating: 0, count: MemoryLayout.size) - (data as NSData).getBytes(&byteArray, length: MemoryLayout.size) - return byteArray -} - -func reverseBytes(_ value: T) -> T { - var result = value - let swappedBytes = Data(byteArrayValue(value).reversed()) - (swappedBytes as NSData).getBytes(&result, length: MemoryLayout.size) - return result -} - public protocol Deserialize { static var size: Int { get } diff --git a/src/Catty/DataStructures/3rdParty/Stack/CBStack.swift b/src/Catty/DataStructures/3rdParty/Stack/CBStack.swift index 076ce4084d..7d2058785d 100755 --- a/src/Catty/DataStructures/3rdParty/Stack/CBStack.swift +++ b/src/Catty/DataStructures/3rdParty/Stack/CBStack.swift @@ -52,7 +52,7 @@ class CBStack { return } else { //establish the new item instance - let childToUse: LLNode = LLNode() + let childToUse = LLNode() childToUse.key = key //set newly created item at the top diff --git a/src/Catty/PocketPaint/Helper/UIImage+FloodFill.m b/src/Catty/PocketPaint/Helper/UIImage+FloodFill.m index 5e1df326c4..8f67f5ab00 100755 --- a/src/Catty/PocketPaint/Helper/UIImage+FloodFill.m +++ b/src/Catty/PocketPaint/Helper/UIImage+FloodFill.m @@ -72,7 +72,7 @@ - (UIImage *) floodFillFromPoint:(CGPoint)startPoint withColor:(UIColor *)newCol unsigned int ocolor = getColorCode(byteIndex, imageData); //Convert newColor to RGBA value so we can save it to image. - int newRed, newGreen, newBlue, newAlpha; + int newRed = 0, newGreen = 0, newBlue = 0, newAlpha = 0; const CGFloat *components = CGColorGetComponents(newColor.CGColor); diff --git a/src/Catty/ViewController/Help/HelpWebViewController.swift b/src/Catty/ViewController/Help/HelpWebViewController.swift index c5861129f0..3dee5f9a35 100644 --- a/src/Catty/ViewController/Help/HelpWebViewController.swift +++ b/src/Catty/ViewController/Help/HelpWebViewController.swift @@ -20,7 +20,7 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */ -import WebKit +@preconcurrency import WebKit class HelpWebViewController: UIViewController, WKUIDelegate, WKNavigationDelegate, UIScrollViewDelegate { private var errorLoadingURL = false diff --git a/src/CattyTests/BluetoothDevices/BluetoothMocks/BluetoothMocks.swift b/src/CattyTests/BluetoothDevices/BluetoothMocks/BluetoothMocks.swift index 7d72067621..c228a0c2c5 100644 --- a/src/CattyTests/BluetoothDevices/BluetoothMocks/BluetoothMocks.swift +++ b/src/CattyTests/BluetoothDevices/BluetoothMocks/BluetoothMocks.swift @@ -31,7 +31,7 @@ class FirmataDelegateMock: FirmataDelegate { var receivedString: String = "" var receivedPin: Int = 0 var receivedPort: Int = 0 - var receivedPortData: [Int] = [Int](repeating: 0, count: 1) + var receivedPortData = [Int](repeating: 0, count: 1) var receivedValue: Int = 0 var analogMapping = NSMutableDictionary() var capabilityQuery = [[Int: Int]]() diff --git a/src/CattyTests/PlayerEngine/Functions/ObjectRecognition/ObjectRecognitionFunctionsTest.swift b/src/CattyTests/PlayerEngine/Functions/ObjectRecognition/ObjectRecognitionFunctionsTest.swift index 486fde238a..5e3963b394 100644 --- a/src/CattyTests/PlayerEngine/Functions/ObjectRecognition/ObjectRecognitionFunctionsTest.swift +++ b/src/CattyTests/PlayerEngine/Functions/ObjectRecognition/ObjectRecognitionFunctionsTest.swift @@ -26,6 +26,7 @@ import XCTest class ObjectRecognitionFunctionsTest: XCTestCase { private enum SensorType { case x, y, width, height } + var idOfDetectedObjectFunction: IDOfDetectedObjectFunction! var objectWithIDVisibleFunction: ObjectWithIDVisibleFunction! var labelOfObjectWithIDFunction: LabelOfObjectWithIDFunction! diff --git a/src/CattyTests/PlayerEngine/Functions/TextRecognition/TextBlockPositionFunctionTest.swift b/src/CattyTests/PlayerEngine/Functions/TextRecognition/TextBlockPositionFunctionTest.swift index 7226065ca5..6393efd2a0 100644 --- a/src/CattyTests/PlayerEngine/Functions/TextRecognition/TextBlockPositionFunctionTest.swift +++ b/src/CattyTests/PlayerEngine/Functions/TextRecognition/TextBlockPositionFunctionTest.swift @@ -26,6 +26,7 @@ import XCTest class TextBlockPositionFunctionTest: XCTestCase { private enum SensorType { case x, y, size } + var textBlockXFunction: TextBlockXFunction! var textBlockYFunction: TextBlockYFunction! var textBlockSizeFunction: TextBlockSizeFunction!