diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 00000000..c701bb3e --- /dev/null +++ b/.swiftformat @@ -0,0 +1,3 @@ +disable_formatting_rules: + +- trailingCommas diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a930efc..282c9905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,9 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/). - While loops were replaced by for loops in places where they were being used inappropriately ([#380](https://github.com/scribe-org/Scribe-iOS/issues/380)). - The [Scribe-i18n](https://github.com/scribe-org/Scribe-i18n) directory has been added for future localization work. - SQLite queries were refactored to extract the DB access logic into a common file ([#378](https://github.com/scribe-org/Scribe-iOS/issues/378)). +- A SwiftLint pull request workflow was added to the codebase to check style and other coding conventions ([#390](https://github.com/scribe-org/Scribe-iOS/issues/390)). +- Trailing commas were removed from the codebase ([#421](https://github.com/scribe-org/Scribe-iOS/issues/421)). +- SwiftFormat was configured to allow for the removal of trailing commas ([#421](https://github.com/scribe-org/Scribe-iOS/issues/421)). # Scribe-iOS 2.3.0 diff --git a/Keyboards/KeyboardsBase/InterfaceVariables.swift b/Keyboards/KeyboardsBase/InterfaceVariables.swift index c769d03a..1a23539d 100644 --- a/Keyboards/KeyboardsBase/InterfaceVariables.swift +++ b/Keyboards/KeyboardsBase/InterfaceVariables.swift @@ -22,7 +22,7 @@ import UIKit // A proxy into which text is typed. var proxy: UITextDocumentProxy! -// MARK: Display Variables +// MARK: - Display Variables // Variables for the keyboard and its appearance. var keyboard = [[String]]() diff --git a/Keyboards/KeyboardsBase/KeyboardViewController.swift b/Keyboards/KeyboardsBase/KeyboardViewController.swift index 4ca59290..4dbedd7e 100644 --- a/Keyboards/KeyboardsBase/KeyboardViewController.swift +++ b/Keyboards/KeyboardsBase/KeyboardViewController.swift @@ -91,7 +91,7 @@ class KeyboardViewController: UIInputViewController { loadKeys() } - // MARK: Display Activation Functions + // MARK: - Display Activation Functions /// Function to load the keyboard interface into which keyboardView is instantiated. func loadInterface() { @@ -137,7 +137,7 @@ class KeyboardViewController: UIInputViewController { btn.isUserInteractionEnabled = false } - // MARK: Override UIInputViewController Functions + // MARK: - Override UIInputViewController Functions /// Includes adding custom view sizing constraints. override func updateViewConstraints() { @@ -259,7 +259,7 @@ class KeyboardViewController: UIInputViewController { } } - // MARK: Scribe Command Elements + // MARK: - Scribe Command Elements // Partitions for autocomplete and autosuggest @IBOutlet var leftAutoPartition: UILabel! @@ -961,7 +961,7 @@ class KeyboardViewController: UIInputViewController { } } - // MARK: Conjugation Variables and Functions + // MARK: - Conjugation Variables and Functions // Note that we use "form" to describe both conjugations and declensions. @IBOutlet var shiftFormsDisplayLeft: UIButton! @@ -1231,20 +1231,20 @@ class KeyboardViewController: UIInputViewController { case .disabled: break case .accusativePersonalSPS, .dativePersonalSPS, .genitivePersonalSPS, - .accusativePossessiveSPS, .dativePossessiveSPS, .genitivePossessiveSPS: + .accusativePossessiveSPS, .dativePossessiveSPS, .genitivePossessiveSPS: formsDisplayDimensions = .view1x2 case .accusativePersonalTPS, .dativePersonalTPS, .genitivePersonalTPS, - .accusativePossessiveTPS, .dativePossessiveTPS, .genitivePossessiveTPS: + .accusativePossessiveTPS, .dativePossessiveTPS, .genitivePossessiveTPS: formsDisplayDimensions = .view3x1 case .accusativePossessiveFPS, .accusativePossessiveSPSInformal, .accusativePossessiveSPSFormal, - .accusativePossessiveTPSMasculine, .accusativePossessiveTPSFeminine, .accusativePossessiveTPSNeutral, - .accusativePossessiveFPP, .accusativePossessiveSPP, .accusativePossessiveTPP, - .dativePossessiveFPS, .dativePossessiveSPSInformal, .dativePossessiveSPSFormal, - .dativePossessiveTPSMasculine, .dativePossessiveTPSFeminine, .dativePossessiveTPSNeutral, - .dativePossessiveFPP, .dativePossessiveSPP, .dativePossessiveTPP, - .genitivePossessiveFPS, .genitivePossessiveSPSInformal, .genitivePossessiveSPSFormal, - .genitivePossessiveTPSMasculine, .genitivePossessiveTPSFeminine, .genitivePossessiveTPSNeutral, - .genitivePossessiveFPP, .genitivePossessiveSPP, .genitivePossessiveTPP: + .accusativePossessiveTPSMasculine, .accusativePossessiveTPSFeminine, .accusativePossessiveTPSNeutral, + .accusativePossessiveFPP, .accusativePossessiveSPP, .accusativePossessiveTPP, + .dativePossessiveFPS, .dativePossessiveSPSInformal, .dativePossessiveSPSFormal, + .dativePossessiveTPSMasculine, .dativePossessiveTPSFeminine, .dativePossessiveTPSNeutral, + .dativePossessiveFPP, .dativePossessiveSPP, .dativePossessiveTPP, + .genitivePossessiveFPS, .genitivePossessiveSPSInformal, .genitivePossessiveSPSFormal, + .genitivePossessiveTPSMasculine, .genitivePossessiveTPSFeminine, .genitivePossessiveTPSNeutral, + .genitivePossessiveFPP, .genitivePossessiveSPP, .genitivePossessiveTPP: formsDisplayDimensions = .view2x2 } } else if @@ -1858,7 +1858,7 @@ class KeyboardViewController: UIInputViewController { } } - // MARK: Load Keys + // MARK: - Load Keys /// Loads the keys given the current constraints. func loadKeys() { @@ -2149,7 +2149,7 @@ class KeyboardViewController: UIInputViewController { } } - // MARK: Button Actions + // MARK: - Button Actions /// Triggers actions based on the press of a key. /// @@ -2656,7 +2656,7 @@ class KeyboardViewController: UIInputViewController { } } - // MARK: Key Press Functions + // MARK: - Key Press Functions /// Auto-capitalization if the cursor is at the start of the proxy. func autoCapAtStartOfProxy() { diff --git a/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift b/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift index 983f7d01..58303144 100644 --- a/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift +++ b/Keyboards/KeyboardsBase/ScribeFunctionality/CommandVariables.swift @@ -93,7 +93,7 @@ var allColoredPrompts: [NSAttributedString] = [] let languagesWithCapitalizedNouns = ["German"] let languagesWithCaseDependantOnPrepositions = ["German", "Russian"] -// MARK: Translate Variables +// MARK: - Translate Variables var translateKeyLbl = "" var translatePrompt = "" @@ -103,7 +103,7 @@ var translatePromptAndPlaceholder = "" var translatePromptAndColorPlaceholder = NSMutableAttributedString() var wordToTranslate = "" -// MARK: Conjugate Variables +// MARK: - Conjugate Variables var conjugateKeyLbl = "" var conjugatePrompt = "" @@ -171,7 +171,7 @@ var verbToDisplay = "" var wordToDisplay = "" var conjugationToDisplay = "" -// MARK: Plural Variables +// MARK: - Plural Variables var pluralKeyLbl = "" var pluralPrompt = "" diff --git a/Scribe/AboutTab/AboutViewController.swift b/Scribe/AboutTab/AboutViewController.swift index f8894a17..acf5d34a 100644 --- a/Scribe/AboutTab/AboutViewController.swift +++ b/Scribe/AboutTab/AboutViewController.swift @@ -35,7 +35,7 @@ final class AboutViewController: BaseTableViewController { } } -// MARK: UITableViewDataSource +// MARK: - UITableViewDataSource extension AboutViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -48,7 +48,7 @@ extension AboutViewController { } } -// MARK: UITableViewDelegate +// MARK: - UITableViewDelegate extension AboutViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/Scribe/InstallationTab/DownloadDataVC.swift b/Scribe/InstallationTab/DownloadDataVC.swift index a1b040bd..eb85616b 100644 --- a/Scribe/InstallationTab/DownloadDataVC.swift +++ b/Scribe/InstallationTab/DownloadDataVC.swift @@ -63,7 +63,9 @@ import UIKit // } // } // -//// MARK: UITableViewDelegate + +// MARK: - UITableViewDelegate + // ///// Function implementation conforming to the UITableViewDelegate protocol. // extension DownloadDataVC: UITableViewDelegate {}