Skip to content

Commit

Permalink
🚨 (swiftformat): --enable blankLinesAtStartOfScope
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Dec 6, 2023
1 parent 8f67b92 commit 78679c8
Show file tree
Hide file tree
Showing 290 changed files with 2 additions and 417 deletions.
2 changes: 2 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
--lineaftermarks true

--enable blankLinesAtEndOfScope
--enable blankLinesAtStartOfScope
--typeblanklines remove

# Disabled rules
13 changes: 0 additions & 13 deletions Apps/BLEKitExample/Sources/Models/Commands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Foundation
// MARK: - LKCommand

enum LKCommand {

static let startByte: UInt8 = 0x2A
static let startByteLength: UInt8 = 0x04
static let ledFull: UInt8 = 0x13
Expand All @@ -17,7 +16,6 @@ enum LKCommand {
// MARK: - LKCommand Led Full

enum LedFull {

static let command: UInt8 = 0x13
static let numberOfValues: UInt8 = 1 + 3 + 1 // EAR/BELT + R, G, B + Checksum
static let ears: UInt8 = 0x14
Expand All @@ -27,7 +25,6 @@ enum LKCommand {
// MARK: - LKCommand Motors

enum Motor {

static let command: UInt8 = 0x20
static let numberOfValues: UInt8 = 1 + 2 + 1 // ID + Spin, Speed + Checksum
static let left: UInt8 = 0x21
Expand All @@ -40,7 +37,6 @@ enum LKCommand {
// MARK: - LKCommand Motivator

enum Motivator {

static let command: UInt8 = 0x50
static let numberOfValues: UInt8 = 1 + 1 // Motivator + Checksum
static let rainbow: UInt8 = 0x51
Expand All @@ -52,7 +48,6 @@ enum LKCommand {
}

func checksum8(_ values: [UInt8]) -> UInt8 {

var checksum: Int = 0

for value in values {
Expand All @@ -65,7 +60,6 @@ func checksum8(_ values: [UInt8]) -> UInt8 {
// MARK: - CommandKit

class CommandKit {

// MARK: - Singleton

static let sharedSingleton = CommandKit()
Expand All @@ -82,7 +76,6 @@ class CommandKit {
// MARK: - Initialisation

init() {

for _ in 0...LKCommand.startByteLength - 1 {
self.startSequence.append(LKCommand.startByte)
}
Expand All @@ -91,7 +84,6 @@ class CommandKit {
// MARK: - Led Functions

func addAllLeds(of earOrBelt: UInt8, rgbColor red: UInt8, _ green: UInt8, _ blue: UInt8) {

let array = [command.LedFull.command, earOrBelt, red, green, blue, checksum8([earOrBelt, red, green, blue])]

for element in array {
Expand All @@ -104,7 +96,6 @@ class CommandKit {
// MARK: - Motor Functions

func addMotor(on leftOrRight: UInt8, direction: UInt8, speed: UInt8) {

let array = [command.Motor.command, leftOrRight, direction, speed, checksum8([leftOrRight, direction, speed])]

for element in array {
Expand All @@ -117,7 +108,6 @@ class CommandKit {
// MARK: - Motivator Functions

func addMotivator(_ motivator: UInt8) {

let array = [command.Motivator.command, motivator, checksum8([motivator])]

for element in array {
Expand All @@ -130,7 +120,6 @@ class CommandKit {
// MARK: - Command Functions

func encapsulate() -> [UInt8] {

var encapsulatedArray: [UInt8] = []

encapsulatedArray.append(contentsOf: self.startSequence)
Expand All @@ -144,7 +133,6 @@ class CommandKit {
}

func getCommands() -> [UInt8] {

var commands: [UInt8] = []

if isEncapsulated {
Expand All @@ -158,7 +146,6 @@ class CommandKit {
}

func flush() {

self.commandSequence.removeAll()
self.numberOfCommands = 0
self.isEncapsulated = false
Expand Down
1 change: 0 additions & 1 deletion Apps/BLEKitExample/Sources/Stores/BotViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import SwiftUI

class BotViewModel: ObservableObject {

// Bot Connect
// Make 'botIsConnected' & 'currentlyConnectedBotIndex' one prop' instead
// if currentlyConnectedBotIndex is not nil, bot is connected for sure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import SwiftUI

struct BotFaceView: View {

@Binding var isSelected: Bool
@Binding var isConnected: Bool
@Binding var name: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ struct BotStore: View {
@ObservedObject var botVM: BotViewModel

var body: some View {

Group {
if bleManager.peripherals.count < 1 {
searchInvite
Expand Down
1 change: 0 additions & 1 deletion Apps/BLEKitExample/Sources/View/RobotListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ struct RobotListView: View {
@EnvironmentObject var botVM: BotViewModel

var body: some View {

VStack {
Spacer()

Expand Down
4 changes: 0 additions & 4 deletions Apps/LekaActivityUIExplorer/Sources/DesignSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ struct TitleView: View {
}

struct FontsView: View {

struct FontView: View {
let font: Font

Expand Down Expand Up @@ -130,7 +129,6 @@ struct FontsView: View {
}

struct ColorsView: View {

struct ColorView: View {
@Environment(\.self) var environment

Expand Down Expand Up @@ -203,7 +201,6 @@ extension Color {
}

struct UIColorsView: View {

struct ColorView: View {
@Environment(\.self) var environment

Expand Down Expand Up @@ -290,7 +287,6 @@ extension UIColor {
}

struct ButtonsView: View {

let colors: [Color] = [
.primary,
.secondary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ let kActivities: [Activity] = [
]

struct GEKNewSystemView: View {

@EnvironmentObject var router: Router

@State var currentActivity: Activity?
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaActivityUIExplorer/Sources/MainApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import SwiftUI

@main
struct LekaActivityUIExplorerApp: App {

@StateObject var router = Router()

var body: some Scene {
Expand Down
2 changes: 0 additions & 2 deletions Apps/LekaActivityUIExplorer/Sources/SwitchBoard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Router: ObservableObject {
}

struct SwitchBoard: View {

@EnvironmentObject var router: Router

var body: some View {
Expand All @@ -40,7 +39,6 @@ struct SwitchBoard: View {
}

struct UIExplorerVersionSelector: View {

@EnvironmentObject var router: Router

@State var presentRobotConnection: Bool = false
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import SwiftUI

struct ContentView: View {

@EnvironmentObject var viewRouter: ViewRouter

var body: some View {
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Data/TilesContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ struct TileContent {
}

enum TileData: Int, CaseIterable, Hashable {

case discovery, curriculums, activities, commands
case signupBravo, signupStep1, signupStep2, signupFinalStep

Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import RobotKit
import SwiftUI

struct HomeView: View {

@EnvironmentObject var navigationVM: NavigationViewModel
@EnvironmentObject var settings: SettingsViewModel
@EnvironmentObject var metrics: UIMetrics
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/MainApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import SwiftUI

@main
struct LekaApp: App {

@StateObject var viewRouter = ViewRouter()
@StateObject var metrics = UIMetrics()
@StateObject var navigationVM = NavigationViewModel()
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/ActivityViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Yams

// @MainActor
class ActivityViewModel: NSObject, ObservableObject, YamlFileDecodable {

func getActivity(_ title: String) -> Activity {
do {
return try self.decodeYamlFile(withName: title, toType: Activity.self)
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/CompanyViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DesignKit
import SwiftUI

class CompanyViewModel: ObservableObject {

@Published var currentCompany = Company(mail: "", password: "", teachers: [], users: [])
@Published var profilesInUse: [UserType: UUID] = [.teacher: UUID(), .user: UUID()]
@Published var selectedProfiles: [UserType: UUID] = [.teacher: UUID(), .user: UUID()]
Expand Down
2 changes: 0 additions & 2 deletions Apps/LekaApp/Sources/Stores/CurriculumViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import SwiftUI
import Yams

class CurriculumViewModel: ObservableObject, YamlFileDecodable {

// MARK: - CurriculumList Published properties

@Published var currentCurriculumCategory: CurriculumCategories = .emotionRecognition
Expand Down Expand Up @@ -69,7 +68,6 @@ class CurriculumViewModel: ObservableObject, YamlFileDecodable {
}

func setCurriculumDetailNavTitle() -> String {

"\(getCurriculumList(category: currentCurriculumCategory).sectionTitle.localized()) \(String(describing: (selectedCurriculum ?? 0)+1))/\(availableCurriculums.count)"
}

Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/NavigationViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Foundation
import SwiftUI

class NavigationViewModel: ObservableObject {

// sidebar utils
@Published var sidebarVisibility = NavigationSplitViewVisibility.all
@Published var showSettings: Bool = false
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/RobotViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import SwiftUI

class RobotViewModel: ObservableObject {

// Robot Connect
// Make 'robotIsConnected' & 'currentlyConnectedRobotIndex' one prop' instead
// if currentlyConnectedRobotIndex is not nil, robot is connected for sure
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import Foundation

class SettingsViewModel: ObservableObject {

// Connexion-related properties - Settings
@Published var companyIsLoggingIn: Bool = false
@Published var companyIsConnected: Bool = false
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Stores/ViewRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ enum Page {
}

class ViewRouter: ObservableObject {

@Published var currentPage: Page = .welcome
}
5 changes: 0 additions & 5 deletions Apps/LekaApp/Sources/Styles/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ struct NoFeedback_ButtonStyle: ButtonStyle {
// MARK: - Edit Button Style -> avatar picker, profile editor, explorer mode tile

struct BorderedCapsule_NoFeedback_ButtonStyle: ButtonStyle {

var font: Font
var color: Color
var isOpaque: Bool = false
Expand All @@ -40,7 +39,6 @@ struct BorderedCapsule_NoFeedback_ButtonStyle: ButtonStyle {
}

struct CircledIcon_NoFeedback_ButtonStyle: ButtonStyle {

var font: Font

func makeBody(configuration: Self.Configuration) -> some View {
Expand Down Expand Up @@ -145,7 +143,6 @@ struct SuccessGaugeStyle: GaugeStyle {
// MARK: - Emotion Buttons Style (Gameplay)

struct ActivityAnswer_ButtonStyle: ButtonStyle {

var isEnabled: Bool = false

func makeBody(configuration: Self.Configuration) -> some View {
Expand All @@ -172,7 +169,6 @@ struct ActivityAnswer_ButtonStyle: ButtonStyle {
// MARK: - Play Sound Button Style (Gameplay)

struct PlaySound_ButtonStyle: ButtonStyle {

var progress: CGFloat

func makeBody(configuration: Self.Configuration) -> some View {
Expand Down Expand Up @@ -203,7 +199,6 @@ struct PlaySound_ButtonStyle: ButtonStyle {
// MARK: - CheerScreen Buttons

struct BorderedCapsule_ButtonStyle: ButtonStyle {

var isFilled: Bool = true

func makeBody(configuration: Self.Configuration) -> some View {
Expand Down
1 change: 0 additions & 1 deletion Apps/LekaApp/Sources/Styles/UIMetrics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Foundation
import SwiftUI

class UIMetrics: ObservableObject {

// MARK: - Global

@Published var reg17: Font = .system(size: 17, weight: .regular)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DesignKit
import SwiftUI

struct ActivityListView: View {

@EnvironmentObject var curriculumVM: CurriculumViewModel
@EnvironmentObject var activityVM: ActivityViewModel
@EnvironmentObject var navigationVM: NavigationViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DesignKit
import SwiftUI

struct ActivityListCell: View {

@EnvironmentObject var metrics: UIMetrics

let activity: Activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DesignKit
import SwiftUI

struct SelectedActivityInstructionsView: View {

@EnvironmentObject var activityVM: ActivityViewModel
@EnvironmentObject var metrics: UIMetrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DesignKit
import SwiftUI

struct GoButton: View {

@EnvironmentObject var company: CompanyViewModel
@EnvironmentObject var activityVM: ActivityViewModel
@EnvironmentObject var navigationVM: NavigationViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import DesignKit
import SwiftUI

struct InstructionsView: View {

@EnvironmentObject var activityVM: ActivityViewModel
@EnvironmentObject var metrics: UIMetrics

Expand Down
Loading

0 comments on commit 78679c8

Please sign in to comment.