diff --git a/.swiftformat b/.swiftformat index 12c17c25e2..a2abf19bff 100644 --- a/.swiftformat +++ b/.swiftformat @@ -4,3 +4,5 @@ --disable all --swiftversion 5.9 + +--enable acronyms diff --git a/Apps/BLEKitExample/Sources/Models/Commands.swift b/Apps/BLEKitExample/Sources/Models/Commands.swift index 581d341249..69a3a57f13 100644 --- a/Apps/BLEKitExample/Sources/Models/Commands.swift +++ b/Apps/BLEKitExample/Sources/Models/Commands.swift @@ -30,7 +30,7 @@ enum LKCommand { enum Motor { static let command: UInt8 = 0x20 - static let numberOfValues: UInt8 = 1 + 2 + 1 // Id + Spin, Speed + Checksum + static let numberOfValues: UInt8 = 1 + 2 + 1 // ID + Spin, Speed + Checksum static let left: UInt8 = 0x21 static let right: UInt8 = 0x22 diff --git a/Apps/BLEKitExample/Sources/Models/Robot.swift b/Apps/BLEKitExample/Sources/Models/Robot.swift index 88dc00fc1c..928fb17347 100644 --- a/Apps/BLEKitExample/Sources/Models/Robot.swift +++ b/Apps/BLEKitExample/Sources/Models/Robot.swift @@ -21,7 +21,7 @@ class Robot: ObservableObject { @Published var battery: Int = 0 @Published var isCharging: Bool = false - @Published var magicCardId: Int = 0 + @Published var magicCardID: Int = 0 @Published var magicCardLanguage: String = "" let commands = CommandKit() @@ -125,7 +125,7 @@ class Robot: ObservableObject { newChar.onNotification = { [weak self] data in if let data = data { - self?.magicCardId = Int(data[1]) + self?.magicCardID = Int(data[1]) } } } diff --git a/Apps/BLEKitExample/Sources/View/RobotView.swift b/Apps/BLEKitExample/Sources/View/RobotView.swift index a18d5f9677..ae39d29e78 100644 --- a/Apps/BLEKitExample/Sources/View/RobotView.swift +++ b/Apps/BLEKitExample/Sources/View/RobotView.swift @@ -38,7 +38,7 @@ struct RobotView: View { } Group { - ReadOnlyView(characteristicName: "Magic Card (ID)", characteristicValue: "\(robot.magicCardId)") + ReadOnlyView(characteristicName: "Magic Card (ID)", characteristicValue: "\(robot.magicCardID)") ReadOnlyView( characteristicName: "MagicCard (Language)", characteristicValue: robot.magicCardLanguage) } diff --git a/Modules/GameEngineKit/Sources/Staging/Melody/MelodyGameplay.swift b/Modules/GameEngineKit/Sources/Staging/Melody/MelodyGameplay.swift index afea638e82..88052a831b 100644 --- a/Modules/GameEngineKit/Sources/Staging/Melody/MelodyGameplay.swift +++ b/Modules/GameEngineKit/Sources/Staging/Melody/MelodyGameplay.swift @@ -22,7 +22,7 @@ public class MelodyGameplay: ObservableObject { public init(song: MelodySongModel) { self.song = song self.state = .playing - self.xyloPlayer.loadMIDIFile(fileUrl: song.midiFile, tempo: song.tempo) + self.xyloPlayer.loadMIDIFile(fileURL: song.midiFile, tempo: song.tempo) self.midiNotes = xyloPlayer.getMidiNotes() self.currentNoteNumber = midiNotes[currentNoteIndex].noteNumber - song.octaveGap diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Utils/AudioPlayer.swift b/Modules/GameEngineKit/Sources/_NewSystem/Utils/AudioPlayer.swift index c642a69582..64dc26c722 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Utils/AudioPlayer.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Utils/AudioPlayer.swift @@ -26,8 +26,8 @@ public class AudioPlayer: NSObject, ObservableObject { didFinishPlaying = false do { - let fileUrl = Bundle.module.url(forResource: audioRecording.file, withExtension: "mp3")! - player = try AVAudioPlayer(contentsOf: fileUrl) + let fileURL = Bundle.module.url(forResource: audioRecording.file, withExtension: "mp3")! + player = try AVAudioPlayer(contentsOf: fileURL) player.delegate = self } catch { print("ERROR - mp3 file not found - \(error)") diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Utils/MIDIPlayer.swift b/Modules/GameEngineKit/Sources/_NewSystem/Utils/MIDIPlayer.swift index 33e996a22b..95b77fbc46 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Utils/MIDIPlayer.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Utils/MIDIPlayer.swift @@ -39,8 +39,8 @@ class MIDIPlayer: ObservableObject { } } - func loadMIDIFile(fileUrl: URL, tempo: Double) { - sequencer.loadMIDIFile(fromURL: fileUrl) + func loadMIDIFile(fileURL: URL, tempo: Double) { + sequencer.loadMIDIFile(fromURL: fileURL) sequencer.setGlobalMIDIOutput(instrument.midiIn) sequencer.setTempo(tempo) } diff --git a/Modules/RobotKit/Sources/Robot+Lights.swift b/Modules/RobotKit/Sources/Robot+Lights.swift index 6cb145e509..c183f8a3ae 100644 --- a/Modules/RobotKit/Sources/Robot+Lights.swift +++ b/Modules/RobotKit/Sources/Robot+Lights.swift @@ -88,8 +88,8 @@ extension Robot { .spot(position, ids: ids, in: color) } - static func range(startId: UInt8, endId: UInt8, in color: Color) -> Self { - .range(start: startId, end: endId, in: color) + static func range(startID: UInt8, endID: UInt8, in color: Color) -> Self { + .range(start: startID, end: endID, in: color) } var cmd: [[UInt8]] { diff --git a/Tuist/.swiftformat b/Tuist/.swiftformat new file mode 100644 index 0000000000..b2d3acdb60 --- /dev/null +++ b/Tuist/.swiftformat @@ -0,0 +1,5 @@ +# Leka - iOS Monorepo +# Copyright 2023 APF France handicap +# SPDX-License-Identifier: Apache-2.0 + +--disable acronyms