Skip to content

Commit

Permalink
CATTY-730 Fix iOS 18 SDK and new Swiftlint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wallisch committed Oct 8, 2024
1 parent 72f2f2e commit ec54826
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private func > <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
}

open var services: [Service] {
let values: [Service] = [Service](self.ownServices.values)
let values = [Service](self.ownServices.values)
return values
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,10 @@ open class StreamPromise<T> {
// FutureStream
open class FutureStream<T> {

private var futures = [Future<T>]()
private typealias InFuture = (Future<T>) -> Void
private var saveCompletes = [InFuture]()

private var saveCompletes = [InFuture]()
private var futures = [Future<T>]()
private var capacity: Int?

internal let defaultExecutionContext: ExecutionContext = QueueContext.main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ func fromHostByteOrder<T>(_ value: T) -> T {
value
}

func byteArrayValue<T>(_ value: T) -> [UInt8] {
let values = [value]
let data = values.withUnsafeBytes { Data($0) }
var byteArray = [UInt8](repeating: 0, count: MemoryLayout<T>.size)
(data as NSData).getBytes(&byteArray, length: MemoryLayout<T>.size)
return byteArray
}

func reverseBytes<T>(_ value: T) -> T {
var result = value
let swappedBytes = Data(byteArrayValue(value).reversed())
(swappedBytes as NSData).getBytes(&result, length: MemoryLayout<T>.size)
return result
}

public protocol Deserialize {
static var size: Int { get }

Expand Down
2 changes: 1 addition & 1 deletion src/Catty/DataStructures/3rdParty/Stack/CBStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CBStack<T> {
return
} else {
//establish the new item instance
let childToUse: LLNode<T> = LLNode<T>()
let childToUse = LLNode<T>()
childToUse.key = key

//set newly created item at the top
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/PocketPaint/Helper/UIImage+FloodFill.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Catty/ViewController/Help/HelpWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit ec54826

Please sign in to comment.