diff --git a/.swiftformat b/.swiftformat index bbbf879c46..0838567218 100644 --- a/.swiftformat +++ b/.swiftformat @@ -46,6 +46,9 @@ --enable enumNamespaces --enumnamespaces always +--enable extensionAccessControl +--extensionacl on-extension + # Disabled rules --disable blankLinesBetweenImports diff --git a/Modules/BLEKit/Examples/BLEKitExample/Sources/Mocks/RobotListViewModel+Mock.swift b/Modules/BLEKit/Examples/BLEKitExample/Sources/Mocks/RobotListViewModel+Mock.swift index 46eebbaaf9..cdd67d560b 100644 --- a/Modules/BLEKit/Examples/BLEKitExample/Sources/Mocks/RobotListViewModel+Mock.swift +++ b/Modules/BLEKit/Examples/BLEKitExample/Sources/Mocks/RobotListViewModel+Mock.swift @@ -6,9 +6,9 @@ import BLEKit import Combine import SwiftUI -extension RobotListViewModel { +public extension RobotListViewModel { // TODO(@ladislas): create protocol and mock RobotDiscoveryModel - public static func mock() -> RobotListViewModel { + static func mock() -> RobotListViewModel { RobotListViewModel(availableRobots: [ // RobotDiscovery.mock(), // RobotDiscovery.mock(), diff --git a/Modules/BLEKit/Sources/Extensions/String+Extension.swift b/Modules/BLEKit/Sources/Extensions/String+Extension.swift index ffadbc2e0e..a55b745aac 100644 --- a/Modules/BLEKit/Sources/Extensions/String+Extension.swift +++ b/Modules/BLEKit/Sources/Extensions/String+Extension.swift @@ -4,8 +4,8 @@ import Foundation -extension String { - public var nilWhenEmpty: String? { +public extension String { + var nilWhenEmpty: String? { self.isEmpty ? nil : self } } diff --git a/Modules/BLEKit/Sources/Extensions/UInt16+Extension.swift b/Modules/BLEKit/Sources/Extensions/UInt16+Extension.swift index b5e94bc758..139bb142a5 100644 --- a/Modules/BLEKit/Sources/Extensions/UInt16+Extension.swift +++ b/Modules/BLEKit/Sources/Extensions/UInt16+Extension.swift @@ -4,16 +4,16 @@ import Foundation -extension UInt16 { - public var highByte: UInt8 { +public extension UInt16 { + var highByte: UInt8 { UInt8(self >> 8) } - public var lowByte: UInt8 { + var lowByte: UInt8 { UInt8(self & 0xff) } - public var data: Data { + var data: Data { Data([self.highByte, self.lowByte]) } } diff --git a/Modules/BLEKit/Sources/Mocks/RobotDiscoveryModel+Mocks.swift b/Modules/BLEKit/Sources/Mocks/RobotDiscoveryModel+Mocks.swift index 32a5132931..abf51d4a34 100644 --- a/Modules/BLEKit/Sources/Mocks/RobotDiscoveryModel+Mocks.swift +++ b/Modules/BLEKit/Sources/Mocks/RobotDiscoveryModel+Mocks.swift @@ -2,8 +2,8 @@ // Copyright 2023 APF France handicap // SPDX-License-Identifier: Apache-2.0 -extension RobotDiscoveryModel { - public static func mock() -> RobotDiscoveryModel { +public extension RobotDiscoveryModel { + static func mock() -> RobotDiscoveryModel { RobotDiscoveryModel( name: "Leka Mock", isCharging: Bool.random(), battery: Int.random(in: 1..<100), osVersion: "1.2.3") } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift index 49fad94644..8e8622d05c 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift @@ -6,8 +6,8 @@ import Foundation // swiftlint:disable nesting -extension Exercise { - public enum Action: Codable { +public extension Exercise { + enum Action: Codable { case ipad(type: ActionType) case robot(type: ActionType) diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Gameplay.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Gameplay.swift index 210d2a19a2..3d009a3994 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Gameplay.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Gameplay.swift @@ -4,8 +4,8 @@ import Foundation -extension Exercise { - public enum Gameplay: String, Codable { +public extension Exercise { + enum Gameplay: String, Codable { case findTheRightAnswers case associateCategories } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift index 6785abdec0..6d26c0ce3b 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift @@ -4,8 +4,8 @@ import Foundation -extension Exercise { - public enum Interface: String, Codable { +public extension Exercise { + enum Interface: String, Codable { case touchToSelect case robotThenTouchToSelect case listenThenTouchToSelect diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Sequence.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Sequence.swift index b59cc689a7..4bd8d8e1fd 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Sequence.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Sequence.swift @@ -4,8 +4,8 @@ import Foundation -extension Exercise { - public struct Sequence: Codable { +public extension Exercise { + struct Sequence: Codable { public let exercises: [Exercise] } } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift b/Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift index 7e61c97a0b..70d5bbb070 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift @@ -4,8 +4,8 @@ import Foundation -extension Exercise { - public enum UIElementType: String, Codable { +public extension Exercise { + enum UIElementType: String, Codable { case image case text case color diff --git a/Modules/DesignKit/Sources/Modifiers/AlertWhenNoUserSelected.swift b/Modules/DesignKit/Sources/Modifiers/AlertWhenNoUserSelected.swift index 6607e52575..2ff91b6345 100644 --- a/Modules/DesignKit/Sources/Modifiers/AlertWhenNoUserSelected.swift +++ b/Modules/DesignKit/Sources/Modifiers/AlertWhenNoUserSelected.swift @@ -47,8 +47,8 @@ struct AlertWhenNoUserSelected: ViewModifier { } } -extension View { - public func alertWhenNoUserSelected() -> some View { +public extension View { + func alertWhenNoUserSelected() -> some View { modifier(AlertWhenNoUserSelected()) } } diff --git a/Modules/DesignKit/Sources/Modifiers/AlertWhenRobotIsNeeded.swift b/Modules/DesignKit/Sources/Modifiers/AlertWhenRobotIsNeeded.swift index aab0a909d3..e9dde71541 100644 --- a/Modules/DesignKit/Sources/Modifiers/AlertWhenRobotIsNeeded.swift +++ b/Modules/DesignKit/Sources/Modifiers/AlertWhenRobotIsNeeded.swift @@ -47,8 +47,8 @@ struct AlertWhenRobotIsNeeded: ViewModifier { } } -extension View { - public func alertWhenRobotIsNeeded() -> some View { +public extension View { + func alertWhenRobotIsNeeded() -> some View { modifier(AlertWhenRobotIsNeeded()) } } diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/LedZoneSelector/LedZoneSelectorView+BeltSectionButton.swift b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/LedZoneSelector/LedZoneSelectorView+BeltSectionButton.swift index 6596c58f6c..adc0de8e86 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/LedZoneSelector/LedZoneSelectorView+BeltSectionButton.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/LedZoneSelector/LedZoneSelectorView+BeltSectionButton.swift @@ -5,8 +5,8 @@ import RobotKit import SwiftUI -extension Robot.Lights { - public var arcAngle: (start: Angle, end: Angle) { +public extension Robot.Lights { + var arcAngle: (start: Angle, end: Angle) { switch self { case .full: return (start: .degrees(0), end: .degrees(360)) diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/ReinforcerButton.swift b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/ReinforcerButton.swift index 54e2533a6f..708e08422b 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/ReinforcerButton.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/RemoteStandard/ReinforcerButton.swift @@ -7,8 +7,8 @@ import RobotKit import SwiftUI // TODO(@ladislas): decide where to put this, keeping it here for now -extension Robot.Reinforcer { - public func icon() -> Image { +public extension Robot.Reinforcer { + func icon() -> Image { switch self { case .spinBlinkGreenOff: return DesignKitAsset.Reinforcers.spinBlinkGreenOff.swiftUIImage diff --git a/Modules/RobotKit/Sources/Extensions/Array+checksum8.swift b/Modules/RobotKit/Sources/Extensions/Array+checksum8.swift index aba7fe018a..84d0312c2a 100644 --- a/Modules/RobotKit/Sources/Extensions/Array+checksum8.swift +++ b/Modules/RobotKit/Sources/Extensions/Array+checksum8.swift @@ -2,8 +2,8 @@ // Copyright 2023 APF France handicap // SPDX-License-Identifier: Apache-2.0 -extension Array where Element == UInt8 { - public var checksum8: UInt8 { +public extension Array where Element == UInt8 { + var checksum8: UInt8 { var checksum: Int = 0 for value in self { diff --git a/Modules/RobotKit/Sources/MagicCards.swift b/Modules/RobotKit/Sources/MagicCards.swift index 6adbc564be..c2b02e2663 100644 --- a/Modules/RobotKit/Sources/MagicCards.swift +++ b/Modules/RobotKit/Sources/MagicCards.swift @@ -30,77 +30,77 @@ public struct MagicCard: Equatable { } } -extension MagicCard { - public static let none: MagicCard = MagicCard(id: 0x00_00) - public static let emergency_stop: MagicCard = MagicCard(id: 0x00_01) - public static let dice_roll: MagicCard = MagicCard(id: 0x00_02) - - public static let color_purple: MagicCard = MagicCard(id: 0x00_03) - public static let color_indigo: MagicCard = MagicCard(id: 0x00_04) - public static let color_blue: MagicCard = MagicCard(id: 0x00_05) - public static let color_green: MagicCard = MagicCard(id: 0x00_06) - public static let color_yellow: MagicCard = MagicCard(id: 0x00_07) - public static let color_orange: MagicCard = MagicCard(id: 0x00_08) - public static let color_red: MagicCard = MagicCard(id: 0x00_09) - - public static let number_0: MagicCard = MagicCard(id: 0x00_0A) - public static let number_1: MagicCard = MagicCard(id: 0x00_0B) - public static let number_2: MagicCard = MagicCard(id: 0x00_0C) - public static let number_3: MagicCard = MagicCard(id: 0x00_0D) - public static let number_4: MagicCard = MagicCard(id: 0x00_0E) - public static let number_5: MagicCard = MagicCard(id: 0x00_0F) - public static let number_6: MagicCard = MagicCard(id: 0x00_10) - public static let number_7: MagicCard = MagicCard(id: 0x00_11) - public static let number_8: MagicCard = MagicCard(id: 0x00_12) - public static let number_9: MagicCard = MagicCard(id: 0x00_13) - public static let number_10: MagicCard = MagicCard(id: 0x00_14) - - public static let shape_square: MagicCard = MagicCard(id: 0x00_15) - public static let shape_circle: MagicCard = MagicCard(id: 0x00_16) - public static let shape_triangle: MagicCard = MagicCard(id: 0x00_17) - public static let shape_star: MagicCard = MagicCard(id: 0x00_18) - - public static let activity_music_quest: MagicCard = MagicCard(id: 0x00_19) - public static let activity_super_simon: MagicCard = MagicCard(id: 0x00_1A) - public static let activity_colored_quest: MagicCard = MagicCard(id: 0x00_1B) - public static let activity_music_colored_board: MagicCard = MagicCard(id: 0x00_1C) - public static let activity_hide_and_seek: MagicCard = MagicCard(id: 0x00_1D) - public static let activity_colors_and_sounds: MagicCard = MagicCard(id: 0x00_1E) - public static let activity_magic_objects: MagicCard = MagicCard(id: 0x00_1F) - public static let activity_dance_freeze: MagicCard = MagicCard(id: 0x00_20) - - public static let remote_standard: MagicCard = MagicCard(id: 0x00_21) - public static let remote_colored_arrows: MagicCard = MagicCard(id: 0x00_22) - - public static let reinforcer_1_blink_green: MagicCard = MagicCard(id: 0x00_23) - public static let reinforcer_2_spin_blink: MagicCard = MagicCard(id: 0x00_24) - public static let reinforcer_3_fire: MagicCard = MagicCard(id: 0x00_25) - public static let reinforcer_4_sprinkles: MagicCard = MagicCard(id: 0x00_26) - public static let reinforcer_5_rainbow: MagicCard = MagicCard(id: 0x00_27) - - public static let emotion_fear_child: MagicCard = MagicCard(id: 0x00_28) - public static let emotion_disgust_child: MagicCard = MagicCard(id: 0x00_29) - public static let emotion_anger_child: MagicCard = MagicCard(id: 0x00_2A) - public static let emotion_joy_child: MagicCard = MagicCard(id: 0x00_2B) - public static let emotion_sadness_child: MagicCard = MagicCard(id: 0x00_2C) - public static let emotion_fear_leka: MagicCard = MagicCard(id: 0x00_2D) - public static let emotion_disgust_leka: MagicCard = MagicCard(id: 0x00_2E) - public static let emotion_anger_leka: MagicCard = MagicCard(id: 0x00_2F) - public static let emotion_joy_leka: MagicCard = MagicCard(id: 0x00_30) - public static let emotion_sadness_leka: MagicCard = MagicCard(id: 0x00_31) - - public static let vegetable_carrot_orange: MagicCard = MagicCard(id: 0x00_32) - public static let vegetable_potato_yellow: MagicCard = MagicCard(id: 0x00_33) - public static let vegetable_salad_green: MagicCard = MagicCard(id: 0x00_34) - public static let vegetable_mushroom_grey: MagicCard = MagicCard(id: 0x00_35) - public static let fruit_strawberry_red: MagicCard = MagicCard(id: 0x00_36) - public static let fruit_cherry_pink: MagicCard = MagicCard(id: 0x00_37) - public static let fruit_apple_green: MagicCard = MagicCard(id: 0x00_38) - public static let fruit_banana_yellow: MagicCard = MagicCard(id: 0x00_39) - public static let fruit_grapes_black: MagicCard = MagicCard(id: 0x00_3A) - - public static let math_arithmetic_substraction_sign_minus: MagicCard = MagicCard(id: 0x00_3B) - public static let math_arithmetic_addition_sign_plus: MagicCard = MagicCard(id: 0x00_3C) +public extension MagicCard { + static let none: MagicCard = MagicCard(id: 0x00_00) + static let emergency_stop: MagicCard = MagicCard(id: 0x00_01) + static let dice_roll: MagicCard = MagicCard(id: 0x00_02) + + static let color_purple: MagicCard = MagicCard(id: 0x00_03) + static let color_indigo: MagicCard = MagicCard(id: 0x00_04) + static let color_blue: MagicCard = MagicCard(id: 0x00_05) + static let color_green: MagicCard = MagicCard(id: 0x00_06) + static let color_yellow: MagicCard = MagicCard(id: 0x00_07) + static let color_orange: MagicCard = MagicCard(id: 0x00_08) + static let color_red: MagicCard = MagicCard(id: 0x00_09) + + static let number_0: MagicCard = MagicCard(id: 0x00_0A) + static let number_1: MagicCard = MagicCard(id: 0x00_0B) + static let number_2: MagicCard = MagicCard(id: 0x00_0C) + static let number_3: MagicCard = MagicCard(id: 0x00_0D) + static let number_4: MagicCard = MagicCard(id: 0x00_0E) + static let number_5: MagicCard = MagicCard(id: 0x00_0F) + static let number_6: MagicCard = MagicCard(id: 0x00_10) + static let number_7: MagicCard = MagicCard(id: 0x00_11) + static let number_8: MagicCard = MagicCard(id: 0x00_12) + static let number_9: MagicCard = MagicCard(id: 0x00_13) + static let number_10: MagicCard = MagicCard(id: 0x00_14) + + static let shape_square: MagicCard = MagicCard(id: 0x00_15) + static let shape_circle: MagicCard = MagicCard(id: 0x00_16) + static let shape_triangle: MagicCard = MagicCard(id: 0x00_17) + static let shape_star: MagicCard = MagicCard(id: 0x00_18) + + static let activity_music_quest: MagicCard = MagicCard(id: 0x00_19) + static let activity_super_simon: MagicCard = MagicCard(id: 0x00_1A) + static let activity_colored_quest: MagicCard = MagicCard(id: 0x00_1B) + static let activity_music_colored_board: MagicCard = MagicCard(id: 0x00_1C) + static let activity_hide_and_seek: MagicCard = MagicCard(id: 0x00_1D) + static let activity_colors_and_sounds: MagicCard = MagicCard(id: 0x00_1E) + static let activity_magic_objects: MagicCard = MagicCard(id: 0x00_1F) + static let activity_dance_freeze: MagicCard = MagicCard(id: 0x00_20) + + static let remote_standard: MagicCard = MagicCard(id: 0x00_21) + static let remote_colored_arrows: MagicCard = MagicCard(id: 0x00_22) + + static let reinforcer_1_blink_green: MagicCard = MagicCard(id: 0x00_23) + static let reinforcer_2_spin_blink: MagicCard = MagicCard(id: 0x00_24) + static let reinforcer_3_fire: MagicCard = MagicCard(id: 0x00_25) + static let reinforcer_4_sprinkles: MagicCard = MagicCard(id: 0x00_26) + static let reinforcer_5_rainbow: MagicCard = MagicCard(id: 0x00_27) + + static let emotion_fear_child: MagicCard = MagicCard(id: 0x00_28) + static let emotion_disgust_child: MagicCard = MagicCard(id: 0x00_29) + static let emotion_anger_child: MagicCard = MagicCard(id: 0x00_2A) + static let emotion_joy_child: MagicCard = MagicCard(id: 0x00_2B) + static let emotion_sadness_child: MagicCard = MagicCard(id: 0x00_2C) + static let emotion_fear_leka: MagicCard = MagicCard(id: 0x00_2D) + static let emotion_disgust_leka: MagicCard = MagicCard(id: 0x00_2E) + static let emotion_anger_leka: MagicCard = MagicCard(id: 0x00_2F) + static let emotion_joy_leka: MagicCard = MagicCard(id: 0x00_30) + static let emotion_sadness_leka: MagicCard = MagicCard(id: 0x00_31) + + static let vegetable_carrot_orange: MagicCard = MagicCard(id: 0x00_32) + static let vegetable_potato_yellow: MagicCard = MagicCard(id: 0x00_33) + static let vegetable_salad_green: MagicCard = MagicCard(id: 0x00_34) + static let vegetable_mushroom_grey: MagicCard = MagicCard(id: 0x00_35) + static let fruit_strawberry_red: MagicCard = MagicCard(id: 0x00_36) + static let fruit_cherry_pink: MagicCard = MagicCard(id: 0x00_37) + static let fruit_apple_green: MagicCard = MagicCard(id: 0x00_38) + static let fruit_banana_yellow: MagicCard = MagicCard(id: 0x00_39) + static let fruit_grapes_black: MagicCard = MagicCard(id: 0x00_3A) + + static let math_arithmetic_substraction_sign_minus: MagicCard = MagicCard(id: 0x00_3B) + static let math_arithmetic_addition_sign_plus: MagicCard = MagicCard(id: 0x00_3C) } // swiftlint:enable identifier_name diff --git a/Modules/RobotKit/Sources/Robot+Colors.swift b/Modules/RobotKit/Sources/Robot+Colors.swift index eda59c23e5..327555b1e4 100644 --- a/Modules/RobotKit/Sources/Robot+Colors.swift +++ b/Modules/RobotKit/Sources/Robot+Colors.swift @@ -6,8 +6,8 @@ import SwiftUI // swiftlint:disable nesting -extension Robot { - public struct Color { +public extension Robot { + struct Color { private let robotRGB: [UInt8] private let screenRGB: [UInt8] @@ -77,19 +77,19 @@ extension Robot { } } -extension Robot.Color { - public static let black: Robot.Color = .init(robot: 0, 0, 0, screen: 0, 0, 0) - public static let white: Robot.Color = .init(robot: 255, 255, 255, screen: 255, 255, 255) +public extension Robot.Color { + static let black: Robot.Color = .init(robot: 0, 0, 0, screen: 0, 0, 0) + static let white: Robot.Color = .init(robot: 255, 255, 255, screen: 255, 255, 255) - public static let red: Robot.Color = .init(robot: 255, 0, 0, screen: 255, 0, 0) - public static let green: Robot.Color = .init(robot: 0, 150, 0, screen: 0, 226, 0) - public static let blue: Robot.Color = .init(robot: 0, 0, 255, screen: 0, 121, 255) + static let red: Robot.Color = .init(robot: 255, 0, 0, screen: 255, 0, 0) + static let green: Robot.Color = .init(robot: 0, 150, 0, screen: 0, 226, 0) + static let blue: Robot.Color = .init(robot: 0, 0, 255, screen: 0, 121, 255) - public static let lightBlue: Robot.Color = .init(robot: 0, 121, 255, screen: 70, 194, 248) - public static let orange: Robot.Color = .init(robot: 248, 100, 0, screen: 255, 143, 0) - public static let purple: Robot.Color = .init(robot: 20, 0, 80, screen: 173, 73, 247) - public static let pink: Robot.Color = .init(robot: 255, 0, 127, screen: 252, 103, 178) - public static let yellow: Robot.Color = .init(robot: 255, 255, 0, screen: 251, 232, 0) + static let lightBlue: Robot.Color = .init(robot: 0, 121, 255, screen: 70, 194, 248) + static let orange: Robot.Color = .init(robot: 248, 100, 0, screen: 255, 143, 0) + static let purple: Robot.Color = .init(robot: 20, 0, 80, screen: 173, 73, 247) + static let pink: Robot.Color = .init(robot: 255, 0, 127, screen: 252, 103, 178) + static let yellow: Robot.Color = .init(robot: 255, 255, 0, screen: 251, 232, 0) } // swiftlint:enable nesting diff --git a/Modules/RobotKit/Sources/Robot+Lights.swift b/Modules/RobotKit/Sources/Robot+Lights.swift index 5684f10257..896bdfe673 100644 --- a/Modules/RobotKit/Sources/Robot+Lights.swift +++ b/Modules/RobotKit/Sources/Robot+Lights.swift @@ -4,8 +4,8 @@ // swiftlint:disable identifier_name nesting cyclomatic_complexity -extension Robot { - public enum Lights { +public extension Robot { + enum Lights { public enum Spot { static let id: UInt8 = 0x10 public enum Position: UInt8 { @@ -210,7 +210,7 @@ extension Robot { } } - public func shine(_ lights: Lights) { + func shine(_ lights: Lights) { log.trace("🤖 SHINE \(lights)") let output = Self.commandGenerator(commands: lights.cmd) @@ -219,7 +219,7 @@ extension Robot { .sendCommand(output) } - public func blacken(_ lights: Lights) { + func blacken(_ lights: Lights) { log.trace("🤖 BLACKEN \(lights)") switch lights { case .all: @@ -249,7 +249,7 @@ extension Robot { } } - public func blacken(_ lights: Lights.Blacken) { + func blacken(_ lights: Lights.Blacken) { log.trace("🤖 BLACKEN \(lights)") switch lights { case .all: @@ -279,7 +279,7 @@ extension Robot { } } - public func stopLights() { + func stopLights() { log.trace("🤖 STOP 🛑 - Lights") shine(.all(in: .black)) } diff --git a/Modules/RobotKit/Sources/Robot+Motion.swift b/Modules/RobotKit/Sources/Robot+Motion.swift index 09db9caedb..897ae6c131 100644 --- a/Modules/RobotKit/Sources/Robot+Motion.swift +++ b/Modules/RobotKit/Sources/Robot+Motion.swift @@ -10,8 +10,8 @@ extension Float { } } -extension Robot { - public enum Motion { +public extension Robot { + enum Motion { static let id: UInt8 = 0x20 enum Motor: UInt8 { @@ -134,7 +134,7 @@ extension Robot { } } - public func move(_ motion: Motion) { + func move(_ motion: Motion) { log.trace("🤖 MOVE \(motion)") let output = Self.commandGenerator(commands: motion.cmd) @@ -142,7 +142,7 @@ extension Robot { .sendCommand(output) } - public func stopMotion() { + func stopMotion() { log.trace("🤖 STOP 🛑 - Motion") move(.stop) } diff --git a/Modules/RobotKit/Sources/Robot+Reinforcers.swift b/Modules/RobotKit/Sources/Robot+Reinforcers.swift index 9418bdb6db..05e503a9c2 100644 --- a/Modules/RobotKit/Sources/Robot+Reinforcers.swift +++ b/Modules/RobotKit/Sources/Robot+Reinforcers.swift @@ -2,8 +2,8 @@ // Copyright 2023 APF France handicap // SPDX-License-Identifier: Apache-2.0 -extension Robot { - public enum Reinforcer: UInt8, CaseIterable { +public extension Robot { + enum Reinforcer: UInt8, CaseIterable { case rainbow = 0x51 case fire = 0x52 case sprinkles = 0x53 @@ -23,7 +23,7 @@ extension Robot { } } - public func run(_ reinforcer: Reinforcer) { + func run(_ reinforcer: Reinforcer) { log.trace("🤖 RUN reinforcer \(reinforcer)") let output = Self.commandGenerator(commands: reinforcer.cmd) diff --git a/Modules/RobotKit/Sources/UI/Buttons/ButtonStyle+Extension.swift b/Modules/RobotKit/Sources/UI/Buttons/ButtonStyle+Extension.swift index 9143cf56f7..2bd1eb1507 100644 --- a/Modules/RobotKit/Sources/UI/Buttons/ButtonStyle+Extension.swift +++ b/Modules/RobotKit/Sources/UI/Buttons/ButtonStyle+Extension.swift @@ -10,14 +10,14 @@ import SwiftUI // -extension ButtonStyle where Self == RobotControlPlainButtonStyle { - public static func robotControlPlainButtonStyle(foreground: Color? = nil, background: Color? = nil) -> Self { +public extension ButtonStyle where Self == RobotControlPlainButtonStyle { + static func robotControlPlainButtonStyle(foreground: Color? = nil, background: Color? = nil) -> Self { .init(foreground: foreground, background: background) } } -extension ButtonStyle where Self == RobotControlBorderedButtonStyle { - public static func robotControlBorderedButtonStyle(foreground: Color? = nil, border: Color? = nil) -> Self { +public extension ButtonStyle where Self == RobotControlBorderedButtonStyle { + static func robotControlBorderedButtonStyle(foreground: Color? = nil, border: Color? = nil) -> Self { .init(foreground: foreground, border: border) } } diff --git a/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotConnectionViewModel+Mocks.swift b/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotConnectionViewModel+Mocks.swift index ad2fc895e6..af4dd20b82 100644 --- a/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotConnectionViewModel+Mocks.swift +++ b/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotConnectionViewModel+Mocks.swift @@ -4,8 +4,8 @@ import Foundation -extension RobotConnectionViewModel { - public static func mock() -> RobotConnectionViewModel { +public extension RobotConnectionViewModel { + static func mock() -> RobotConnectionViewModel { let viewModel = RobotConnectionViewModel() viewModel.robotDiscoveries = [ .mock(), diff --git a/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotDiscoveryViewModel+Mocks.swift b/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotDiscoveryViewModel+Mocks.swift index 70143a48da..8a8c9a08db 100644 --- a/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotDiscoveryViewModel+Mocks.swift +++ b/Modules/RobotKit/Sources/UI/ViewModels/Mocks/RobotDiscoveryViewModel+Mocks.swift @@ -5,16 +5,16 @@ import Foundation // TODO(@ladislas): move to UtilsKit frameworks -extension String { - public static func random(length: Int) +public extension String { + static func random(length: Int) -> String { let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" return String((0.. [String: InfoPlist.Value] { +public extension InfoPlist { + static func base(version: String) -> [String: InfoPlist.Value] { [ "CFBundleShortVersionString": "\(version)", "CFBundleVersion": "\(version)", diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates+App_iOS.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates+App_iOS.swift index 777ee28d1f..0426865fc7 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates+App_iOS.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+Templates+App_iOS.swift @@ -4,8 +4,8 @@ import ProjectDescription -extension Project { - public static func iOSApp( +public extension Project { + static func iOSApp( name: String, version: String = "1.0.0", deploymentTarget: DeploymentTarget = .iOS(targetVersion: "16.0", devices: .ipad), diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates+App_macOS.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates+App_macOS.swift index ec1f12bf8f..2f5e4fbe22 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates+App_macOS.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+Templates+App_macOS.swift @@ -4,8 +4,8 @@ import ProjectDescription -extension Project { - public static func macOSApp( +public extension Project { + static func macOSApp( name: String, version: String = "1.0.0", dependencies: [TargetDependency] diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates+Cli.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates+Cli.swift index b99112b62c..113dbdcddd 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates+Cli.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+Templates+Cli.swift @@ -4,8 +4,8 @@ import ProjectDescription -extension Project { - public static func cli( +public extension Project { + static func cli( name: String, version: String = "1.0.0", dependencies: [TargetDependency] diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates+Module.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates+Module.swift index 38831cd728..adb3c1a1b9 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates+Module.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+Templates+Module.swift @@ -14,8 +14,8 @@ public struct ModuleExample { } } -extension Project { - public static func module( +public extension Project { + static func module( name: String, platform: Platform, product: Product = .staticLibrary, diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates.swift index 2296753f78..beab4b5039 100644 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift +++ b/Tuist/ProjectDescriptionHelpers/Project+Templates.swift @@ -16,7 +16,7 @@ extension Project { // - internal static func makeFrameworkTargets( + static func makeFrameworkTargets( name: String, platform: Platform, product: Product = .staticLibrary, dependencies: [TargetDependency] ) -> [Target] { diff --git a/Tuist/ProjectDescriptionHelpers/TargetScripts.swift b/Tuist/ProjectDescriptionHelpers/TargetScripts.swift index 4d582383af..e246a6b47a 100644 --- a/Tuist/ProjectDescriptionHelpers/TargetScripts.swift +++ b/Tuist/ProjectDescriptionHelpers/TargetScripts.swift @@ -4,13 +4,13 @@ import ProjectDescription -extension TargetScript { - public static let swiftLint = TargetScript.post( +public extension TargetScript { + static let swiftLint = TargetScript.post( path: Path.relativeToRoot("Scripts/SwiftLintRunScript.sh"), name: "SwiftLint", basedOnDependencyAnalysis: false) - public static func linters() -> [TargetScript] { + static func linters() -> [TargetScript] { let turnOffLinters = Environment.turnOffLinters.getBoolean(default: false) let defaultLinters: [TargetScript] = [