Skip to content

Commit

Permalink
🚨 (swiftformat): --enable extensionAccessControl
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Dec 6, 2023
1 parent 7e74f4f commit 8999955
Show file tree
Hide file tree
Showing 30 changed files with 154 additions and 151 deletions.
3 changes: 3 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
--enable enumNamespaces
--enumnamespaces always

--enable extensionAccessControl
--extensionacl on-extension

# Disabled rules

--disable blankLinesBetweenImports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions Modules/BLEKit/Sources/Extensions/String+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import Foundation

extension String {
public var nilWhenEmpty: String? {
public extension String {
var nilWhenEmpty: String? {
self.isEmpty ? nil : self
}
}
8 changes: 4 additions & 4 deletions Modules/BLEKit/Sources/Extensions/UInt16+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
4 changes: 2 additions & 2 deletions Modules/BLEKit/Sources/Mocks/RobotDiscoveryModel+Mocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/ContentKit/Sources/Exercise/Exercise+Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions Modules/ContentKit/Sources/Exercise/Exercise+Gameplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import Foundation

extension Exercise {
public enum Gameplay: String, Codable {
public extension Exercise {
enum Gameplay: String, Codable {
case findTheRightAnswers
case associateCategories
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Modules/ContentKit/Sources/Exercise/Exercise+Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import Foundation

extension Exercise {
public struct Sequence: Codable {
public extension Exercise {
struct Sequence: Codable {
public let exercises: [Exercise]
}
}
4 changes: 2 additions & 2 deletions Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ struct AlertWhenNoUserSelected: ViewModifier {
}
}

extension View {
public func alertWhenNoUserSelected() -> some View {
public extension View {
func alertWhenNoUserSelected() -> some View {
modifier(AlertWhenNoUserSelected())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ struct AlertWhenRobotIsNeeded: ViewModifier {
}
}

extension View {
public func alertWhenRobotIsNeeded() -> some View {
public extension View {
func alertWhenRobotIsNeeded() -> some View {
modifier(AlertWhenRobotIsNeeded())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Modules/RobotKit/Sources/Extensions/Array+checksum8.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
142 changes: 71 additions & 71 deletions Modules/RobotKit/Sources/MagicCards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 13 additions & 13 deletions Modules/RobotKit/Sources/Robot+Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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
Loading

0 comments on commit 8999955

Please sign in to comment.