From bb6821fe69354e4351123a645628da160bd72972 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 19:52:12 +0100 Subject: [PATCH 1/6] Configure SwiftLint on CI --- .buildkite/pipeline.yml | 11 ++++++++++- .buildkite/release-builds.yml | 2 +- .swiftlint.yml | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a392465d7..639aabc04 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -2,7 +2,7 @@ common_params: # Common plugin settings to use with the `plugins` key. - &common_plugins - - automattic/a8c-ci-toolkit#3.0.1 + - automattic/a8c-ci-toolkit#3.1.0 # Common environment values to use with the `env` key. - &common_env IMAGE_ID: xcode-15.2-xl @@ -14,6 +14,15 @@ steps: env: *common_env plugins: *common_plugins + - label: ":swift: SwiftLint" + command: run_swiftlint --strict + plugins: *common_plugins + notify: + - github_commit_status: + context: "SwiftLint" + agents: + queue: "default" + - label: "🛠 Verify App Store Target Builds" command: .buildkite/commands/build-and-test-app-store.sh env: *common_env diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index e6cb70ac8..77f5c38e0 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -2,7 +2,7 @@ common_params: # Common plugin settings to use with the `plugins` key. - &common_plugins - - automattic/a8c-ci-toolkit#3.0.1 + - automattic/a8c-ci-toolkit#3.1.0 # Common environment values to use with the `env` key. - &common_env IMAGE_ID: xcode-15.2-xl diff --git a/.swiftlint.yml b/.swiftlint.yml index 1c6bbc400..c93fce6f7 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,3 +1,5 @@ +swiftlint_version: 0.54.0 + # Project configuration excluded: - Pods @@ -16,6 +18,10 @@ only_rules: # if,for,while,do statements shouldn't wrap their conditionals in parentheses. - control_statement + - discarded_notification_center_observer + + - duplicate_imports + # Arguments can be omitted when matching enums with associated types if they # are not used. - empty_enum_arguments @@ -30,6 +36,8 @@ only_rules: # the declaration. - opening_brace + - overridden_super_call + # Files should have a single trailing newline. - trailing_newline @@ -39,6 +47,8 @@ only_rules: # Lines should not have trailing whitespace. - trailing_whitespace + - vertical_whitespace + - custom_rules # Rules configuration From 16869a29a7365ef0fc3d4728791c7718902b9576 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 20:01:44 +0100 Subject: [PATCH 2/6] Configure SwiftLint via Podfile --- Podfile | 14 ++++++++++++++ Podfile.lock | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Podfile b/Podfile index 920406946..473b61028 100644 --- a/Podfile +++ b/Podfile @@ -10,6 +10,20 @@ APP_MACOS_DEPLOYMENT_TARGET = Gem::Version.new('10.14') platform :osx, APP_MACOS_DEPLOYMENT_TARGET workspace 'Simplenote.xcworkspace' +## Tools +## =================== +## + +def swiftlint_version + require 'yaml' + + YAML.load_file('.swiftlint.yml')['swiftlint_version'] +end + +abstract_target 'Tools' do + pod 'SwiftLint', swiftlint_version +end + # Main # abstract_target 'Automattic' do diff --git a/Podfile.lock b/Podfile.lock index cd2746b88..33d5654ff 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -10,17 +10,21 @@ PODS: - Simperium-OSX/SocketRocket (1.9.0) - Simperium-OSX/SPReachability (1.9.0) - Simperium-OSX/SSKeychain (1.9.0) + - SwiftLint (0.54.0) DEPENDENCIES: - Simperium-OSX (= 1.9.0) + - SwiftLint (= 0.54.0) SPEC REPOS: trunk: - Simperium-OSX + - SwiftLint SPEC CHECKSUMS: Simperium-OSX: bc465c8830e5b731e2489085459acc96160104d6 + SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211 -PODFILE CHECKSUM: c01d124e1d7acadfa1b6c7a961645f7721f5ed31 +PODFILE CHECKSUM: 0c6e1eaa48de269bee6c152747e29ea455cb1e74 COCOAPODS: 1.14.1 From 744a1e9354e6466f3021fb9df72e7da228a05628 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 20:03:48 +0100 Subject: [PATCH 3/6] Configure SwiftLint as a Build phase, removing Rake config --- Rakefile | 79 +--------------------------- Simplenote.xcodeproj/project.pbxproj | 19 +++++++ 2 files changed, 21 insertions(+), 77 deletions(-) diff --git a/Rakefile b/Rakefile index 9a36f3518..90e33d248 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,6 @@ require 'yaml' require 'digest' # Constants -SWIFTLINT_VERSION = '0.41.0' XCODE_WORKSPACE = 'Simplenote.xcworkspace' XCODE_SCHEME = 'Simplenote' XCODE_CONFIGURATION = 'Debug' @@ -20,7 +19,7 @@ desc 'Install required dependencies' task dependencies: %w[dependencies:check] namespace :dependencies do - task check: %w[bundler:check bundle:check pod:check lint:check] + task check: %w[bundler:check bundle:check pod:check] namespace :bundler do task :check do @@ -77,42 +76,6 @@ namespace :dependencies do end CLOBBER << 'Pods' end - - namespace :lint do - task :check do - if swiftlint_needs_install - dependency_failed('SwiftLint') - Rake::Task['dependencies:lint:install'].invoke - end - end - - task :install do - fold('install.swiftlint') do - puts "Installing SwiftLint #{SWIFTLINT_VERSION} into #{swiftlint_path}" - Dir.mktmpdir do |tmpdir| - # Try first using a binary release - zipfile = "#{tmpdir}/swiftlint-#{SWIFTLINT_VERSION}.zip" - sh "curl --fail --location -o #{zipfile} https://github.com/realm/SwiftLint/releases/download/#{SWIFTLINT_VERSION}/portable_swiftlint.zip || true" - if File.exist?(zipfile) - extracted_dir = "#{tmpdir}/swiftlint-#{SWIFTLINT_VERSION}" - sh "unzip #{zipfile} -d #{extracted_dir}" - FileUtils.mkdir_p("#{swiftlint_path}/bin") - FileUtils.cp("#{extracted_dir}/swiftlint", "#{swiftlint_path}/bin/swiftlint") - else - sh "git clone --quiet https://github.com/realm/SwiftLint.git #{tmpdir}" - Dir.chdir(tmpdir) do - sh "git checkout --quiet #{SWIFTLINT_VERSION}" - sh 'git submodule --quiet update --init --recursive' - FileUtils.rm_rf(swiftlint_path) - FileUtils.mkdir_p(swiftlint_path) - sh "make prefix_install PREFIX='#{swiftlint_path}'" - end - end - end - end - end - CLOBBER << 'vendor/swiftlint' - end end CLOBBER << 'vendor' @@ -147,20 +110,8 @@ task :clean do xcodebuild(:clean) end -desc 'Checks the source for style errors' -task lint: %w[dependencies:lint:check] do - swiftlint %w[lint --quiet] -end - -namespace :lint do - desc 'Automatically corrects style errors where possible' - task autocorrect: %w[dependencies:lint:check] do - swiftlint %w[autocorrect] - end -end - namespace :git do - hooks = %w[pre-commit post-checkout post-merge] + hooks = %w[post-checkout post-merge] desc 'Install git hooks' task :install_hooks do @@ -213,12 +164,6 @@ namespace :git do end namespace :git do - task pre_commit: %(dependencies:lint:check) do - swiftlint %w[lint --quiet --strict] - rescue StandardError - exit $CHILD_STATUS.exitstatus - end - task :post_merge do check_dependencies_hook end @@ -254,26 +199,6 @@ def podfile_locked? podfile_checksum == lockfile_checksum end -def swiftlint_path - "#{PROJECT_DIR}/vendor/swiftlint" -end - -def swiftlint(args) - args = [swiftlint_bin] + args - sh(*args) -end - -def swiftlint_bin - "#{swiftlint_path}/bin/swiftlint" -end - -def swiftlint_needs_install - return true unless File.exist?(swiftlint_bin) - - installed_version = `"#{swiftlint_bin}" version`.chomp - (installed_version != SWIFTLINT_VERSION) -end - def xcodebuild(*build_cmds) cmd = 'xcodebuild' cmd += " -destination 'platform=iOS Simulator,name=iPhone 6s'" diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj index c7fb6b47c..aae115ef7 100644 --- a/Simplenote.xcodeproj/project.pbxproj +++ b/Simplenote.xcodeproj/project.pbxproj @@ -1695,6 +1695,7 @@ buildConfigurationList = 26F72AA914032D2A00A7935E /* Build configuration list for PBXNativeTarget "Simplenote" */; buildPhases = ( 38E241AE28F50F41EF5E8346 /* [CP] Check Pods Manifest.lock */, + 3C6F268E2B8D16F900A66FDB /* SwiftLint */, 26F72A8414032D2A00A7935E /* Sources */, 26F72A8514032D2A00A7935E /* Frameworks */, 26F72A8614032D2A00A7935E /* Resources */, @@ -1973,6 +1974,24 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 3C6F268E2B8D16F900A66FDB /* SwiftLint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftLint; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "[ $CI ] && exit 0\n./Pods/SwiftLint/swiftlint\n"; + }; 4E51756AEE6CFE89EAD49829 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; From 338cc71559f91cf5d7f31e75dde905e6c09b40b3 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 20:04:10 +0100 Subject: [PATCH 4/6] Remove Hound configuration --- .hound.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .hound.yml diff --git a/.hound.yml b/.hound.yml deleted file mode 100644 index 0d5250000..000000000 --- a/.hound.yml +++ /dev/null @@ -1,7 +0,0 @@ -fail_on_violations: true - -rubocop: - enabled: false - -swiftlint: - config_file: .swiftlint.yml From 23d08fe7167f05aa69aff08f5dac2da750f6d91c Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 20:04:36 +0100 Subject: [PATCH 5/6] Fix SwiftLint violations --- Scripts/fix-translation.swift | 7 +-- Simplenote/AboutViewController.swift | 42 +++++++------- .../AccountVerificationCoordinator.swift | 3 - .../AccountVerificationViewController.swift | 10 +--- Simplenote/AppKitConstants.swift | 1 - Simplenote/Array+Simplenote.swift | 2 - Simplenote/AuthViewController+Swift.swift | 8 +-- Simplenote/AuthWindowController.swift | 2 - Simplenote/BackgroundView.swift | 2 - Simplenote/BreadcrumbsViewController.swift | 11 +--- Simplenote/Bundle+Simplenote.swift | 1 - Simplenote/Button.swift | 9 +-- Simplenote/ClipView.swift | 2 - Simplenote/CollaborateViewController.swift | 6 +- Simplenote/ColorStudio.swift | 1 - Simplenote/DateFormatter+Simplenote.swift | 1 - Simplenote/EmailVerification.swift | 1 - Simplenote/HeaderTableCellView.swift | 1 - Simplenote/HorizontalScrollView.swift | 3 +- Simplenote/InterlinkProcessor.swift | 6 -- Simplenote/InterlinkResultsController.swift | 4 -- Simplenote/InterlinkViewController.swift | 7 --- Simplenote/LinkTableCellView.swift | 2 - Simplenote/MagicLinkAuthenticator.swift | 2 - Simplenote/MainWindowController.swift | 7 --- Simplenote/MarkdownViewController.swift | 7 --- Simplenote/MetricTableViewCell.swift | 2 - Simplenote/MetricsViewController.swift | 13 ----- Simplenote/MigrationsHandler.swift | 2 - .../NSAnimationContext+Simplenote.swift | 1 - Simplenote/NSAppearance+Simplenote.swift | 3 +- .../NSAttributedString+Simplenote.swift | 1 - ...SAttributedStringToMarkdownConverter.swift | 2 - Simplenote/NSBezierPath+Simplenote.swift | 10 ++-- Simplenote/NSBox+Simplenote.swift | 1 - Simplenote/NSColor+Simplenote.swift | 1 - Simplenote/NSColor+Theme.swift | 6 +- Simplenote/NSEdgeInsets+Simplenote.swift | 1 - Simplenote/NSEvent+Simplenote.swift | 2 - Simplenote/NSFont+Simplenote.swift | 1 - Simplenote/NSFont+Theme.swift | 1 - Simplenote/NSImage+Simplenote.swift | 1 - Simplenote/NSImageName+Simplenote.swift | 2 - ...NSMutableAttributedString+Simplenote.swift | 1 - Simplenote/NSNotification+Simplenote.swift | 1 - Simplenote/NSObject+Helpers.swift | 1 - Simplenote/NSPasteboard+Simplenote.swift | 1 - Simplenote/NSProcessInfo+Simplenote.swift | 1 - Simplenote/NSRange+Simplenote.swift | 1 - .../NSRegularExpression+Simplenote.swift | 1 - Simplenote/NSScreen+Simplenote.swift | 1 - Simplenote/NSScrollView+Simplenote.swift | 1 - Simplenote/NSSearchField+Simplenote.swift | 1 - Simplenote/NSSortDescriptor+Simplenote.swift | 1 - Simplenote/NSStoryboard+Simplenote.swift | 5 -- Simplenote/NSString+Simplenote.swift | 3 - Simplenote/NSTableView+Simplenote.swift | 1 - Simplenote/NSTableViewCell+Simplenote.swift | 1 - Simplenote/NSTextStorage+Simplenote.swift | 1 - Simplenote/NSTextView+Simplenote.swift | 13 +---- ...erInterfaceItemIdentifier+Simplenote.swift | 1 - Simplenote/NSView+Simplenote.swift | 1 - .../NSVisualEffectView+Simplenote.swift | 2 - Simplenote/NSWindow+Simplenote.swift | 1 - Simplenote/NSWindow+Transitions.swift | 1 - ...NSWindowFrameAutosaveName+Simplenote.swift | 1 - Simplenote/Note+Interlinks.swift | 1 - Simplenote/Note+Simplenote.swift | 3 - .../NoteEditorViewController+Swift.swift | 24 -------- Simplenote/NoteListController.swift | 5 -- Simplenote/NoteListFilter.swift | 2 - Simplenote/NoteListPrefixFormatter.swift | 1 - Simplenote/NoteListViewController.swift | 24 -------- Simplenote/NoteMetrics.swift | 2 - Simplenote/NoteTableCellView.swift | 10 ---- Simplenote/NumberFormatter+Simplenote.swift | 1 - Simplenote/Options.swift | 4 -- Simplenote/PopoverWindow.swift | 3 - Simplenote/PopoverWindowController.swift | 4 -- Simplenote/PreferencesViewController.swift | 14 ++--- Simplenote/PrivacyViewController.swift | 3 - Simplenote/PublishViewController.swift | 15 +---- Simplenote/ReferenceTableViewCell.swift | 2 - Simplenote/SPAboutTextField.swift | 2 +- Simplenote/SPApplication.swift | 1 - Simplenote/SPBucket+Simplenote.swift | 1 - Simplenote/SPExporter.swift | 3 - Simplenote/SPTextAttachment.swift | 5 -- Simplenote/SPTextField.swift | 4 -- Simplenote/SPTextView.swift | 3 +- Simplenote/SPTracker+Swift.swift | 3 +- Simplenote/SPUserInterface.swift | 2 - Simplenote/SearchField.swift | 57 ++++++++----------- Simplenote/SearchQuery+Simplenote.swift | 1 - Simplenote/SeparatorTableViewCell.swift | 1 - Simplenote/SignupRemote.swift | 1 - .../SignupVerificationViewController.swift | 8 --- Simplenote/Simperium+Simplenote.swift | 4 -- Simplenote/SimplenoteAppDelegate+Swift.swift | 12 +--- Simplenote/SimplenoteConstants.swift | 1 - Simplenote/SortMode.swift | 3 - Simplenote/SpacerTableViewCell.swift | 1 - Simplenote/SplitItemMetrics.swift | 2 - Simplenote/SplitView.swift | 2 - Simplenote/SplitViewController.swift | 11 ---- Simplenote/String+Simplenote.swift | 4 -- Simplenote/TableRowView.swift | 8 +-- Simplenote/TagAttachmentCell.swift | 9 +-- Simplenote/TagListFilter.swift | 2 - Simplenote/TagListRow.swift | 3 - Simplenote/TagListState.swift | 2 - Simplenote/TagListViewController+Swift.swift | 43 +++++--------- Simplenote/TagTableCellView.swift | 4 -- Simplenote/TagTextFormatter.swift | 5 +- Simplenote/TagsField.swift | 12 +--- Simplenote/TagsFieldCell.swift | 3 - Simplenote/TextViewInputHandler.swift | 2 - Simplenote/ThemeOption.swift | 2 - Simplenote/ToolbarState.swift | 3 - Simplenote/ToolbarView.swift | 4 -- Simplenote/URL+Interlink.swift | 1 - Simplenote/UnicodeScalar+Simplenote.swift | 1 - Simplenote/UserDefaults+Simplenote.swift | 2 - Simplenote/Version.swift | 3 - Simplenote/VersionsController.swift | 5 -- Simplenote/VersionsViewController.swift | 12 +--- Simplenote/Window.swift | 7 --- SimplenoteTests/EmailVerificationTests.swift | 3 +- .../MockAccountVerificationRemote.swift | 1 - SimplenoteTests/MockStorage+Sample.swift | 1 - SimplenoteTests/MockStorage.swift | 4 -- SimplenoteTests/MockTextView.swift | 2 - SimplenoteTests/MockURLSession.swift | 3 +- SimplenoteTests/MockURLSessionDataTask.swift | 1 - .../NSAttributedStringSimplenoteTests.swift | 1 - ...ibutedStringToMarkdownConverterTests.swift | 2 - .../NSRegularExpressionSimplenoteTests.swift | 2 - SimplenoteTests/NSStringSimplenoteTests.swift | 11 ++-- .../NSTextViewSimplenoteTests.swift | 44 +++++++------- SimplenoteTests/NSUserDefaults+Tests.swift | 1 - SimplenoteTests/NoteBodyExcerptTests.swift | 1 - SimplenoteTests/NoteListControllerTests.swift | 11 +--- SimplenoteTests/OptionsTests.swift | 1 - SimplenoteTests/StringContentSliceTests.swift | 1 - SimplenoteTests/StringSimplenoteTests.swift | 1 - .../TextViewInputHandlerTests.swift | 2 - .../UnicodeScalarSimplenoteTests.swift | 1 - 147 files changed, 121 insertions(+), 596 deletions(-) diff --git a/Scripts/fix-translation.swift b/Scripts/fix-translation.swift index b5539980a..871361468 100755 --- a/Scripts/fix-translation.swift +++ b/Scripts/fix-translation.swift @@ -2,14 +2,12 @@ import Foundation - guard CommandLine.arguments.count > 2 else { print("This helper tool replaces empty Localized Strings found in *File A*, with the ones found in *File B*") print("Usage: fix-translation path/to/Localizable.strings path/to/Failsafe.strings") exit(1) } - /// Replaces all of the **Empty Strings** in the specified file, with the entries contained in a "Fallback Map". /// func replaceEmptyTranslations(in filename: String, fallbackMap: [String: String]) throws { @@ -42,7 +40,6 @@ func stringByFixingEmptyValue(in string: String, fallbackMap: [String: String]) return String(format: "\"%@\" = \"%@\";", key, fixedValue) } - /// Extracts the substring from the specified TextCheckingResult Range, if possible. /// func extractSubstring(from string: String, match: NSTextCheckingResult, rangeIndex: Int) -> String? { @@ -54,10 +51,9 @@ func extractSubstring(from string: String, match: NSTextCheckingResult, rangeInd return (string as NSString).substring(with: range) } - /// Loads a Localizations file in memory, and returns a Dictionary with its contents. /// -func loadStrings(from filename: String) throws -> [String: String] { +func loadStrings(from filename: String) throws -> [String: String] { let contents = try String(contentsOfFile: filename) let regexp = try NSRegularExpression(pattern: "^\"(.*)\" = \"(.*)\";$", options: []) var output = [String: String]() @@ -81,7 +77,6 @@ func loadStrings(from filename: String) throws -> [String: String] { return output } - /// Main! /// do { diff --git a/Simplenote/AboutViewController.swift b/Simplenote/AboutViewController.swift index 33db052de..26c12a619 100644 --- a/Simplenote/AboutViewController.swift +++ b/Simplenote/AboutViewController.swift @@ -1,6 +1,5 @@ import Cocoa - class AboutViewController: NSViewController { private enum Constants { static let blogUrl = "https://simplenote.com/blog" @@ -15,32 +14,31 @@ class AboutViewController: NSViewController { /// Background /// - @IBOutlet private var backgroundBox: NSBox! + @IBOutlet private var backgroundBox: NSBox! /// Logo /// - @IBOutlet private var logoImageView: NSImageView! + @IBOutlet private var logoImageView: NSImageView! /// Blog /// - @IBOutlet private var blogView: BackgroundView! - @IBOutlet private var twitterView: BackgroundView! - @IBOutlet private var githubView: BackgroundView! - @IBOutlet private var hiringView: BackgroundView! - @IBOutlet private var contactView: BackgroundView! + @IBOutlet private var blogView: BackgroundView! + @IBOutlet private var twitterView: BackgroundView! + @IBOutlet private var githubView: BackgroundView! + @IBOutlet private var hiringView: BackgroundView! + @IBOutlet private var contactView: BackgroundView! /// Labels /// @IBOutlet private var hiringTitleLabel: NSTextField! - @IBOutlet private var hiringTextLabel: NSTextField! - @IBOutlet private var helpLabel: NSTextField! - @IBOutlet private var contactLabel: NSTextField! - @IBOutlet private var tosLabel: SPAboutTextField! - @IBOutlet private var privacyLabel: SPAboutTextField! - @IBOutlet private var californiaLabel: SPAboutTextField! - @IBOutlet private var versionLabel: NSTextField! - @IBOutlet private var copyrightLabel: NSTextField! - + @IBOutlet private var hiringTextLabel: NSTextField! + @IBOutlet private var helpLabel: NSTextField! + @IBOutlet private var contactLabel: NSTextField! + @IBOutlet private var tosLabel: SPAboutTextField! + @IBOutlet private var privacyLabel: SPAboutTextField! + @IBOutlet private var californiaLabel: SPAboutTextField! + @IBOutlet private var versionLabel: NSTextField! + @IBOutlet private var copyrightLabel: NSTextField! // MARK: - Overridden API(s) @@ -124,11 +122,11 @@ class AboutViewController: NSViewController { let copyrightText = String(format: "© %d Automattic", thisYear) // No need for translation copyrightLabel.stringValue = copyrightText } - + @objc func blogLabelClick() { NSWorkspace.shared.open(URL(string: Constants.blogUrl)!) } - + @objc func twitterLabelClick() { NSWorkspace.shared.open(URL(string: Constants.twitterUrl)!) } @@ -136,11 +134,11 @@ class AboutViewController: NSViewController { @objc func githubLabelClick() { NSWorkspace.shared.open(URL(string: Constants.githubUrl)!) } - + @objc func hiringLabelClick() { NSWorkspace.shared.open(URL(string: Constants.hiringUrl)!) } - + @objc func privacyLabelClick() { NSWorkspace.shared.open(URL(string: Constants.privacyUrl)!) } @@ -148,7 +146,7 @@ class AboutViewController: NSViewController { @objc func helpLabelClick() { NSWorkspace.shared.open(URL(string: Constants.helpUrl)!) } - + @objc func termsLabelClick() { NSWorkspace.shared.open(URL(string: Constants.termsUrl)!) } diff --git a/Simplenote/AccountVerificationCoordinator.swift b/Simplenote/AccountVerificationCoordinator.swift index edbe85172..f4c346fad 100644 --- a/Simplenote/AccountVerificationCoordinator.swift +++ b/Simplenote/AccountVerificationCoordinator.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - AccountVerificationCoordinator // @objc @@ -14,7 +13,6 @@ class AccountVerificationCoordinator: NSObject { /// private var parentViewController: NSViewController - /// Designated Initializer /// - parentViewController: ViewController that will be presenting Account Verification /// @@ -68,7 +66,6 @@ class AccountVerificationCoordinator: NSObject { } } - // MARK: - User Interface Helpers // private extension AccountVerificationCoordinator { diff --git a/Simplenote/AccountVerificationViewController.swift b/Simplenote/AccountVerificationViewController.swift index 90cff4142..5391e4f98 100644 --- a/Simplenote/AccountVerificationViewController.swift +++ b/Simplenote/AccountVerificationViewController.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - AccountVerificationViewController // class AccountVerificationViewController: NSViewController { @@ -56,7 +55,6 @@ class AccountVerificationViewController: NSViewController { } } - // MARK: - Actions // extension AccountVerificationViewController { @@ -98,7 +96,6 @@ extension AccountVerificationViewController { } } - // MARK: - Private // private extension AccountVerificationViewController { @@ -111,7 +108,7 @@ private extension AccountVerificationViewController { switch result { case .success: onSuccess?() - case .failure(_): + case .failure: self?.presentErrorAlert() } @@ -144,7 +141,6 @@ private extension AccountVerificationViewController { } } - // MARK: - Refreshing UI // private extension AccountVerificationViewController { @@ -196,7 +192,6 @@ private extension AccountVerificationViewController { } } - // MARK: - Tracks // private extension AccountVerificationViewController { @@ -213,7 +208,6 @@ private extension AccountVerificationViewController { } } - // MARK: - Configuration // struct AccountVerificationConfiguration: Equatable { @@ -245,7 +239,6 @@ extension AccountVerificationConfiguration { errorMessageTitle: Localization.Verify.errorMessageTitle) } - // MARK: - UI Metrics // private enum Settings { @@ -253,7 +246,6 @@ private enum Settings { static let bodyHightlightFont = NSFont.systemFont(ofSize: 16, weight: .semibold) } - // MARK: - Localization // private enum Localization { diff --git a/Simplenote/AppKitConstants.swift b/Simplenote/AppKitConstants.swift index 38349f47d..59b28ba17 100644 --- a/Simplenote/AppKitConstants.swift +++ b/Simplenote/AppKitConstants.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - AppKit Constants, so that we don't repeat ourselves forever! // enum AppKitConstants { diff --git a/Simplenote/Array+Simplenote.swift b/Simplenote/Array+Simplenote.swift index 97f835b88..d2f551918 100644 --- a/Simplenote/Array+Simplenote.swift +++ b/Simplenote/Array+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote Methods // extension Array where Element == String { @@ -25,7 +24,6 @@ extension Array where Element == String { } } - // MARK: - Array + NSView Convenience API // extension Array where Element == NSView { diff --git a/Simplenote/AuthViewController+Swift.swift b/Simplenote/AuthViewController+Swift.swift index c6a045433..e6d1dd4b4 100644 --- a/Simplenote/AuthViewController+Swift.swift +++ b/Simplenote/AuthViewController+Swift.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - AuthViewController: Interface Initialization // extension AuthViewController { @@ -35,7 +34,6 @@ extension AuthViewController { } } - // MARK: - Dynamic Properties // extension AuthViewController { @@ -51,7 +49,6 @@ extension AuthViewController { } } - // MARK: - Refreshing // extension AuthViewController { @@ -100,7 +97,7 @@ extension AuthViewController { passwordFieldHeightConstraint.constant = Metrics.passwordHeight(signingIn: signingIn) forgotPasswordHeightConstraint.constant = Metrics.forgotHeight(signingIn: signingIn) wordPressSSOHeightConstraint.constant = Metrics.wordPressHeight(signingIn: signingIn) - + let fields = [passwordField, forgotPasswordButton, wordPressSSOButton].compactMap { $0 } let alphaStart = signingIn ? AppKitConstants.alpha0_0 : AppKitConstants.alpha1_0 let alphaEnd = signingIn ? AppKitConstants.alpha1_0 : AppKitConstants.alpha0_0 @@ -145,7 +142,6 @@ extension AuthViewController { } } - // MARK: - Action Handlers // extension AuthViewController { @@ -184,7 +180,6 @@ extension AuthViewController { } } - // MARK: - Presenting! // extension AuthViewController { @@ -256,7 +251,6 @@ private enum Metrics { } } - // MARK: - Localization // private enum Localization { diff --git a/Simplenote/AuthWindowController.swift b/Simplenote/AuthWindowController.swift index 154dd952b..cd996535d 100644 --- a/Simplenote/AuthWindowController.swift +++ b/Simplenote/AuthWindowController.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - AuthWindowController // class AuthWindowController: NSWindowController, SPAuthenticationInterface { @@ -18,7 +17,6 @@ class AuthWindowController: NSWindowController, SPAuthenticationInterface { } } - // MARK: - Initializer init() { diff --git a/Simplenote/BackgroundView.swift b/Simplenote/BackgroundView.swift index 35dfba6f3..7102141de 100644 --- a/Simplenote/BackgroundView.swift +++ b/Simplenote/BackgroundView.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - BackgroundView // @objcMembers @@ -80,7 +79,6 @@ class BackgroundView: NSView { /// var forwardsWindowDragEvents = false - // MARK: - Overridden Methods override func draw(_ dirtyRect: NSRect) { diff --git a/Simplenote/BreadcrumbsViewController.swift b/Simplenote/BreadcrumbsViewController.swift index b6504b7f2..600b1bdd3 100644 --- a/Simplenote/BreadcrumbsViewController.swift +++ b/Simplenote/BreadcrumbsViewController.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - BreadcrumbsViewController // class BreadcrumbsViewController: NSViewController { @@ -21,12 +20,10 @@ class BreadcrumbsViewController: NSViewController { /// @IBOutlet private var noteImageView: NSImageView! - /// TextField: Note /// @IBOutlet private var noteTextField: NSTextField! - /// Status: Search /// private var statusForSearch = String() { @@ -68,7 +65,6 @@ class BreadcrumbsViewController: NSViewController { /// private var isUserTagSelected: Bool = false - // MARK: - Lifecycle override func viewDidLoad() { @@ -82,7 +78,6 @@ class BreadcrumbsViewController: NSViewController { } } - // MARK: - Theming // private extension BreadcrumbsViewController { @@ -94,7 +89,6 @@ private extension BreadcrumbsViewController { } } - // MARK: - Public API(s) // extension BreadcrumbsViewController { @@ -111,7 +105,7 @@ extension BreadcrumbsViewController { func tagsControllerDidUpdateFilter(_ filter: TagListFilter) { statusForTags = filter.title isUserTagSelected = { - guard case .tag(_) = filter else { + guard case .tag = filter else { return false } @@ -155,7 +149,6 @@ extension BreadcrumbsViewController { } } - // MARK: - Private Helpers // private extension BreadcrumbsViewController { @@ -173,7 +166,6 @@ private extension BreadcrumbsViewController { } } - // MARK: - Interface // private extension BreadcrumbsViewController { @@ -215,7 +207,6 @@ private extension BreadcrumbsViewController { } } - // MARK: - Metrics // private enum Metrics { diff --git a/Simplenote/Bundle+Simplenote.swift b/Simplenote/Bundle+Simplenote.swift index 6585eca18..5fe184807 100644 --- a/Simplenote/Bundle+Simplenote.swift +++ b/Simplenote/Bundle+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - /// Bundle: Simplenote Methods /// extension Bundle { diff --git a/Simplenote/Button.swift b/Simplenote/Button.swift index f43ca5231..b5a45aae3 100644 --- a/Simplenote/Button.swift +++ b/Simplenote/Button.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - Button // class Button: NSButton { @@ -24,7 +23,6 @@ class Button: NSButton { } } - // MARK: - ButtonCell // class ButtonCell: NSButtonCell { @@ -68,16 +66,15 @@ class ButtonCell: NSButtonCell { let titleFont = font ?? NSFont.systemFont(ofSize: NSFont.systemFontSize) let titleColor = textColor ?? .white let attributedTitle = NSAttributedString(string: title, attributes: [ - .paragraphStyle : paragraphStyle, - .foregroundColor : titleColor, - .font : titleFont + .paragraphStyle: paragraphStyle, + .foregroundColor: titleColor, + .font: titleFont ]) attributedTitle.draw(in: titleFrame) } } - // MARK: - Metrics // private enum Metrics { diff --git a/Simplenote/ClipView.swift b/Simplenote/ClipView.swift index 1703a3899..6b9b2ee9a 100644 --- a/Simplenote/ClipView.swift +++ b/Simplenote/ClipView.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSClipView // class ClipView: NSClipView { @@ -19,7 +18,6 @@ class ClipView: NSClipView { return nil } - for subview in subviews { let translated = convert(point, to: subview) guard let result = subview.hitTest(translated) else { diff --git a/Simplenote/CollaborateViewController.swift b/Simplenote/CollaborateViewController.swift index 4e5c280b0..d5a1a62c6 100644 --- a/Simplenote/CollaborateViewController.swift +++ b/Simplenote/CollaborateViewController.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - CollaborateViewController // class CollaborateViewController: NSViewController { @@ -21,8 +20,7 @@ class CollaborateViewController: NSViewController { } } - - // MARK - View Lifecycle + // MARK: - View Lifecycle deinit { NotificationCenter.default.removeObserver(self) @@ -35,7 +33,6 @@ class CollaborateViewController: NSViewController { } } - // MARK: - Private // private extension CollaborateViewController { @@ -52,7 +49,6 @@ private extension CollaborateViewController { } } - // MARK: - NSPopoverDelegate // extension CollaborateViewController: NSPopoverDelegate { diff --git a/Simplenote/ColorStudio.swift b/Simplenote/ColorStudio.swift index 6c03ed8a0..3c31def68 100644 --- a/Simplenote/ColorStudio.swift +++ b/Simplenote/ColorStudio.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Color Studio Constants // Ref. https://github.com/Automattic/color-studio // diff --git a/Simplenote/DateFormatter+Simplenote.swift b/Simplenote/DateFormatter+Simplenote.swift index 52d264199..8cd19fe07 100644 --- a/Simplenote/DateFormatter+Simplenote.swift +++ b/Simplenote/DateFormatter+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - DateFormatter // extension DateFormatter { diff --git a/Simplenote/EmailVerification.swift b/Simplenote/EmailVerification.swift index 194d16798..9ff8f62d6 100644 --- a/Simplenote/EmailVerification.swift +++ b/Simplenote/EmailVerification.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - EmailVerification // struct EmailVerification { diff --git a/Simplenote/HeaderTableCellView.swift b/Simplenote/HeaderTableCellView.swift index 342a40ff6..a15ffcc59 100644 --- a/Simplenote/HeaderTableCellView.swift +++ b/Simplenote/HeaderTableCellView.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - HeaderTableCellView // class HeaderTableCellView: NSTableCellView { diff --git a/Simplenote/HorizontalScrollView.swift b/Simplenote/HorizontalScrollView.swift index 4e982e24c..a703b58bb 100644 --- a/Simplenote/HorizontalScrollView.swift +++ b/Simplenote/HorizontalScrollView.swift @@ -1,7 +1,6 @@ import Foundation import Cocoa - // MARK: - HorizontalScrollView // This NSScrollView subclass remaps Vertical Scroll events into Horizontal Scroll events, in order to // support ScrollWheel events performed with a mouse (single axis device!). @@ -12,7 +11,7 @@ class HorizontalScrollView: NSScrollView { /// Whenever the scroll event happens on the Y axis, we'll generate a new Scroll Event, instead, and we'll remap the deltaY. /// Why: we need to support Scroll Wheel events, performed with a mouse (with a single axis). /// - guard (abs(event.deltaX) <= abs(event.deltaY)), let cgEvent = event.cgEvent?.copy() else { + guard abs(event.deltaX) <= abs(event.deltaY), let cgEvent = event.cgEvent?.copy() else { super.scrollWheel(with: event) return } diff --git a/Simplenote/InterlinkProcessor.swift b/Simplenote/InterlinkProcessor.swift index fcc33dade..45b7bd8b6 100644 --- a/Simplenote/InterlinkProcessor.swift +++ b/Simplenote/InterlinkProcessor.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - InterlinkProcessorDelegate // protocol InterlinkProcessorDelegate: NSObjectProtocol { @@ -10,7 +9,6 @@ protocol InterlinkProcessorDelegate: NSObjectProtocol { func interlinkProcessor(_ processor: InterlinkProcessor, insert text: String, in range: Range) } - // MARK: - InterlinkProcessor // class InterlinkProcessor: NSObject { @@ -39,7 +37,6 @@ class InterlinkProcessor: NSObject { /// weak var delegate: InterlinkProcessorDelegate? - /// Designated Initialier /// init(viewContext: NSManagedObjectContext, parentTextView: SPTextView) { @@ -47,7 +44,6 @@ class InterlinkProcessor: NSObject { self.parentTextView = parentTextView } - /// Displays the Interlink Lookup Window at the cursor's location when all of the following are **true**: /// /// 1. We're not performing an Undo OP @@ -94,7 +90,6 @@ class InterlinkProcessor: NSObject { } } - // MARK: - Interlinking Autocomplete: Private API(s) // private extension InterlinkProcessor { @@ -118,7 +113,6 @@ private extension InterlinkProcessor { } } - // MARK: - Interlinking Autocomplete: Private API(s) // private extension InterlinkProcessor { diff --git a/Simplenote/InterlinkResultsController.swift b/Simplenote/InterlinkResultsController.swift index ca7b4a159..25a4316e5 100644 --- a/Simplenote/InterlinkResultsController.swift +++ b/Simplenote/InterlinkResultsController.swift @@ -1,7 +1,6 @@ import Foundation import SimplenoteFoundation - // MARK: - InterlinkResultsController // class InterlinkResultsController { @@ -25,7 +24,6 @@ class InterlinkResultsController { try? resultsController.performFetch() } - /// Returns the collection of Notes filtered by the specified Keyword in their title, excluding a specific ObjectID /// - Important: Returns `nil` when there are no results! /// @@ -34,7 +32,6 @@ class InterlinkResultsController { } } - // MARK: - Private // private extension InterlinkResultsController { @@ -70,7 +67,6 @@ private extension InterlinkResultsController { } } - // MARK: - Settings! // private enum Settings { diff --git a/Simplenote/InterlinkViewController.swift b/Simplenote/InterlinkViewController.swift index 359c6b188..a173e3960 100644 --- a/Simplenote/InterlinkViewController.swift +++ b/Simplenote/InterlinkViewController.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - InterlinkViewController // class InterlinkViewController: NSViewController { @@ -46,7 +45,6 @@ class InterlinkViewController: NSViewController { } } - // MARK: - Setup! // private extension InterlinkViewController { @@ -69,7 +67,6 @@ private extension InterlinkViewController { } } - // MARK: - Action Handlers // extension InterlinkViewController { @@ -96,7 +93,6 @@ private extension InterlinkViewController { } } - // MARK: - Wrappers // private extension InterlinkViewController { @@ -106,7 +102,6 @@ private extension InterlinkViewController { } } - // MARK: - NSTableViewDataSource // extension InterlinkViewController: NSTableViewDataSource { @@ -116,7 +111,6 @@ extension InterlinkViewController: NSTableViewDataSource { } } - // MARK: - NSTableViewDelegate // extension InterlinkViewController: SPTableViewDelegate { @@ -153,7 +147,6 @@ extension InterlinkViewController: SPTableViewDelegate { } } - // MARK: - Settings! // private enum Settings { diff --git a/Simplenote/LinkTableCellView.swift b/Simplenote/LinkTableCellView.swift index e17fa3f98..5f37dae25 100644 --- a/Simplenote/LinkTableCellView.swift +++ b/Simplenote/LinkTableCellView.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - LinkTableCellView // @objcMembers @@ -46,7 +45,6 @@ class LinkTableCellView: NSTableCellView { } } - // MARK: - Selection Workaround // private extension LinkTableCellView { diff --git a/Simplenote/MagicLinkAuthenticator.swift b/Simplenote/MagicLinkAuthenticator.swift index af9f8e561..89a71d37a 100644 --- a/Simplenote/MagicLinkAuthenticator.swift +++ b/Simplenote/MagicLinkAuthenticator.swift @@ -22,7 +22,6 @@ struct MagicLinkAuthenticator { } } - // MARK: - [URLQueryItem] Helper // private extension Array where Element == URLQueryItem { @@ -40,7 +39,6 @@ private extension Array where Element == URLQueryItem { } } - // MARK: - Constants // private struct RequestSignupURL { diff --git a/Simplenote/MainWindowController.swift b/Simplenote/MainWindowController.swift index e3674153d..8c5cb1d83 100644 --- a/Simplenote/MainWindowController.swift +++ b/Simplenote/MainWindowController.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - MainWindowController // class MainWindowController: NSWindowController { @@ -22,7 +21,6 @@ class MainWindowController: NSWindowController { } } - // MARK: - Overridden Methods deinit { @@ -38,7 +36,6 @@ class MainWindowController: NSWindowController { } } - // MARK: - NSWindowDelegate // extension MainWindowController: NSWindowDelegate { @@ -50,7 +47,6 @@ extension MainWindowController: NSWindowDelegate { } } - // MARK: - Initialization // private extension MainWindowController { @@ -88,7 +84,6 @@ private extension MainWindowController { } } - // MARK: - Semaphore Workaround // private extension MainWindowController { @@ -104,7 +99,6 @@ private extension MainWindowController { } } - // MARK: - Notifications // extension MainWindowController { @@ -127,7 +121,6 @@ extension MainWindowController { } } - // MARK: - Metrics // private enum Metrics { diff --git a/Simplenote/MarkdownViewController.swift b/Simplenote/MarkdownViewController.swift index ae3513e7e..a43d0624e 100644 --- a/Simplenote/MarkdownViewController.swift +++ b/Simplenote/MarkdownViewController.swift @@ -2,7 +2,6 @@ import Foundation import WebKit import SimplenoteFoundation - // MARK: - MarkdownViewController // @objcMembers @@ -41,8 +40,6 @@ class MarkdownViewController: NSViewController { /// private var entityObserver: EntityObserver? - - // MARK: - Lifecycle deinit { @@ -92,7 +89,6 @@ class MarkdownViewController: NSViewController { } } - // MARK: - WKNavigationDelegate // extension MarkdownViewController: WKNavigationDelegate { @@ -111,7 +107,6 @@ extension MarkdownViewController: WKNavigationDelegate { } } - // MARK: - EntityObserverDelegate // extension MarkdownViewController: EntityObserverDelegate { @@ -121,7 +116,6 @@ extension MarkdownViewController: EntityObserverDelegate { } } - // MARK: - Private // private extension MarkdownViewController { @@ -136,7 +130,6 @@ private extension MarkdownViewController { } } - // MARK: - Notification Helpers // private extension MarkdownViewController { diff --git a/Simplenote/MetricTableViewCell.swift b/Simplenote/MetricTableViewCell.swift index 0d5f704d7..27e37d2e5 100644 --- a/Simplenote/MetricTableViewCell.swift +++ b/Simplenote/MetricTableViewCell.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - MetricTableViewCell // class MetricTableViewCell: NSTableCellView { @@ -40,7 +39,6 @@ class MetricTableViewCell: NSTableCellView { } } - // MARK: - Private API(s) // private extension MetricTableViewCell { diff --git a/Simplenote/MetricsViewController.swift b/Simplenote/MetricsViewController.swift index d55ae915e..9ad6eb749 100644 --- a/Simplenote/MetricsViewController.swift +++ b/Simplenote/MetricsViewController.swift @@ -2,14 +2,12 @@ import Foundation import AppKit import SimplenoteFoundation - // MARK: - MetricsControllerDelegate // protocol MetricsControllerDelegate: AnyObject { func metricsController(_ controller: MetricsViewController, selected note: Note) } - // MARK: - MetricsViewController // class MetricsViewController: NSViewController { @@ -65,7 +63,6 @@ class MetricsViewController: NSViewController { /// weak var delegate: MetricsControllerDelegate? - // MARK: - Lifecycle deinit { @@ -96,7 +93,6 @@ class MetricsViewController: NSViewController { } } - // MARK: - Private // private extension MetricsViewController { @@ -127,7 +123,6 @@ private extension MetricsViewController { } } - // MARK: - Enclosing Popover: Customize! // extension MetricsViewController: NSPopoverDelegate { @@ -137,7 +132,6 @@ extension MetricsViewController: NSPopoverDelegate { } } - // MARK: - Theme Support // private extension MetricsViewController { @@ -157,7 +151,6 @@ private extension MetricsViewController { } } - // MARK: - EntityObserverDelegate // extension MetricsViewController: EntityObserverDelegate { @@ -167,7 +160,6 @@ extension MetricsViewController: EntityObserverDelegate { } } - // MARK: - Refreshing! // private extension MetricsViewController { @@ -252,7 +244,6 @@ private extension MetricsViewController { } } - // MARK: - NSTableViewDataSource // extension MetricsViewController: NSTableViewDataSource { @@ -262,7 +253,6 @@ extension MetricsViewController: NSTableViewDataSource { } } - // MARK: - NSTableViewDelegate // extension MetricsViewController: NSTableViewDelegate { @@ -290,7 +280,6 @@ extension MetricsViewController: NSTableViewDelegate { } } - // MARK: - Cell Initialization // private extension MetricsViewController { @@ -342,7 +331,6 @@ private extension MetricsViewController { } } - // MARK: - Private Types // private enum Metrics { @@ -370,7 +358,6 @@ extension Row { } } - private func +=(lhs: inout [Row], rhs: Row) { lhs.append(rhs) } diff --git a/Simplenote/MigrationsHandler.swift b/Simplenote/MigrationsHandler.swift index db15d149b..1241484db 100644 --- a/Simplenote/MigrationsHandler.swift +++ b/Simplenote/MigrationsHandler.swift @@ -1,7 +1,6 @@ import Foundation import os.log - // MARK: - Simplenote's Upgrade handling flows // @objcMembers @@ -34,7 +33,6 @@ class MigrationsHandler: NSObject { } } - // MARK: - Private Methods // private extension MigrationsHandler { diff --git a/Simplenote/NSAnimationContext+Simplenote.swift b/Simplenote/NSAnimationContext+Simplenote.swift index 506ea7648..6b3881453 100644 --- a/Simplenote/NSAnimationContext+Simplenote.swift +++ b/Simplenote/NSAnimationContext+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - NSAnimationContext + Simplenote // extension NSAnimationContext { diff --git a/Simplenote/NSAppearance+Simplenote.swift b/Simplenote/NSAppearance+Simplenote.swift index fe66709a3..8f7967d3e 100644 --- a/Simplenote/NSAppearance+Simplenote.swift +++ b/Simplenote/NSAppearance+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation - -// MARK - Simplenote Methods +// MARK: - Simplenote Methods // extension NSAppearance { diff --git a/Simplenote/NSAttributedString+Simplenote.swift b/Simplenote/NSAttributedString+Simplenote.swift index 157bbf7f2..c0cedb424 100644 --- a/Simplenote/NSAttributedString+Simplenote.swift +++ b/Simplenote/NSAttributedString+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSMutableAttributedString Simplenote Methods // extension NSAttributedString { diff --git a/Simplenote/NSAttributedStringToMarkdownConverter.swift b/Simplenote/NSAttributedStringToMarkdownConverter.swift index 76f76b5fa..464f31002 100644 --- a/Simplenote/NSAttributedStringToMarkdownConverter.swift +++ b/Simplenote/NSAttributedStringToMarkdownConverter.swift @@ -1,6 +1,5 @@ import Cocoa - // MARK: - NSAttributedString to Markdown Converter // class NSAttributedStringToMarkdownConverter: NSObject { @@ -13,7 +12,6 @@ class NSAttributedStringToMarkdownConverter: NSObject { /// private static let checked = "- [x]" - /// Returns the NSString representation of a given NSAttributedString. /// @objc diff --git a/Simplenote/NSBezierPath+Simplenote.swift b/Simplenote/NSBezierPath+Simplenote.swift index 4a5d1d200..d1333299b 100644 --- a/Simplenote/NSBezierPath+Simplenote.swift +++ b/Simplenote/NSBezierPath+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSBezierPath + Simplenote // extension NSBezierPath { @@ -27,15 +26,14 @@ extension NSBezierPath { let bottomLeftRadius = corners.contains(.bottomLeft) ? targetRadius : .zero move(to: origin) - appendArc(from: topLeftOrigin, to: topRightOrigin, radius: topLeftRadius) - appendArc(from: topRightOrigin, to: bottomRightOrigin, radius: topRightRadius) - appendArc(from: bottomRightOrigin, to: bottomLeftOrigin, radius: bottomRightRadius) - appendArc(from: bottomLeftOrigin, to: topLeftOrigin, radius: bottomLeftRadius) + appendArc(from: topLeftOrigin, to: topRightOrigin, radius: topLeftRadius) + appendArc(from: topRightOrigin, to: bottomRightOrigin, radius: topRightRadius) + appendArc(from: bottomRightOrigin, to: bottomLeftOrigin, radius: bottomRightRadius) + appendArc(from: bottomLeftOrigin, to: topLeftOrigin, radius: bottomLeftRadius) close() } } - // MARK: - RectCorner // struct RectCorner: OptionSet { diff --git a/Simplenote/NSBox+Simplenote.swift b/Simplenote/NSBox+Simplenote.swift index 507d0fd9d..425bbfdde 100644 --- a/Simplenote/NSBox+Simplenote.swift +++ b/Simplenote/NSBox+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSBox.BoxType // extension NSBox.BoxType { diff --git a/Simplenote/NSColor+Simplenote.swift b/Simplenote/NSColor+Simplenote.swift index 0cf80dde1..9a0dae99b 100644 --- a/Simplenote/NSColor+Simplenote.swift +++ b/Simplenote/NSColor+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - HTML Colors // extension NSColor { diff --git a/Simplenote/NSColor+Theme.swift b/Simplenote/NSColor+Theme.swift index a3f51186e..611917ec1 100644 --- a/Simplenote/NSColor+Theme.swift +++ b/Simplenote/NSColor+Theme.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSColor + Theme API // extension NSColor { @@ -12,7 +11,6 @@ extension NSColor { } } - // MARK: - Dynamic Colors // extension NSColor { @@ -39,7 +37,7 @@ extension NSColor { } return (lightStudio, lightColorAlpha) } - + return NSColor(name: nil) { let targetColor = colorProvider($0.isDark) return NSColor(studioColor: targetColor.value, alpha: targetColor.alpha) @@ -47,7 +45,6 @@ extension NSColor { } } - // MARK: - Simplenote Colors! // extension NSColor { @@ -242,7 +239,6 @@ extension NSColor { } } - // MARK: - Internal Colors // private extension NSColor { diff --git a/Simplenote/NSEdgeInsets+Simplenote.swift b/Simplenote/NSEdgeInsets+Simplenote.swift index 0d78058d5..77e2ff589 100644 --- a/Simplenote/NSEdgeInsets+Simplenote.swift +++ b/Simplenote/NSEdgeInsets+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSEdgeInsets + Simplenote // extension NSEdgeInsets { diff --git a/Simplenote/NSEvent+Simplenote.swift b/Simplenote/NSEvent+Simplenote.swift index bc879bdca..fec819398 100644 --- a/Simplenote/NSEvent+Simplenote.swift +++ b/Simplenote/NSEvent+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSEvent.SpecialKey + Simplenote // extension NSEvent.SpecialKey { @@ -24,7 +23,6 @@ extension NSEvent.SpecialKey { } } - // MARK: - NSEvent + Simplenote // extension NSEvent { diff --git a/Simplenote/NSFont+Simplenote.swift b/Simplenote/NSFont+Simplenote.swift index 74e9789b2..9a6ffecd5 100644 --- a/Simplenote/NSFont+Simplenote.swift +++ b/Simplenote/NSFont+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - NSFont + Simplenote // extension NSFont { diff --git a/Simplenote/NSFont+Theme.swift b/Simplenote/NSFont+Theme.swift index f8f7d332b..1132f444c 100644 --- a/Simplenote/NSFont+Theme.swift +++ b/Simplenote/NSFont+Theme.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSFont + Theme API // extension NSFont { diff --git a/Simplenote/NSImage+Simplenote.swift b/Simplenote/NSImage+Simplenote.swift index 897bbc38b..b190e610d 100644 --- a/Simplenote/NSImage+Simplenote.swift +++ b/Simplenote/NSImage+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import os.log - // MARK: - NSImage + Simplenote // extension NSImage { diff --git a/Simplenote/NSImageName+Simplenote.swift b/Simplenote/NSImageName+Simplenote.swift index 34fd116dd..736bfeb94 100644 --- a/Simplenote/NSImageName+Simplenote.swift +++ b/Simplenote/NSImageName+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSImage.Name // extension NSImage.Name { @@ -25,7 +24,6 @@ extension NSImage.Name { /// static let disclosureRight = NSImage.Name("icon_disclosure_right") - /// Toolbar: History /// static let history = NSImage.Name("button_history") diff --git a/Simplenote/NSMutableAttributedString+Simplenote.swift b/Simplenote/NSMutableAttributedString+Simplenote.swift index 766865133..872e0ca99 100644 --- a/Simplenote/NSMutableAttributedString+Simplenote.swift +++ b/Simplenote/NSMutableAttributedString+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSMutableAttributedString Simplenote Methods // extension NSMutableAttributedString { diff --git a/Simplenote/NSNotification+Simplenote.swift b/Simplenote/NSNotification+Simplenote.swift index 3ab8e18a7..71c947d9b 100644 --- a/Simplenote/NSNotification+Simplenote.swift +++ b/Simplenote/NSNotification+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - NSNotification Simplenote Methods // extension NSNotification { diff --git a/Simplenote/NSObject+Helpers.swift b/Simplenote/NSObject+Helpers.swift index 88c9eb366..257c557f4 100644 --- a/Simplenote/NSObject+Helpers.swift +++ b/Simplenote/NSObject+Helpers.swift @@ -1,6 +1,5 @@ import Foundation - /// NSObject: Helper Methods /// extension NSObject { diff --git a/Simplenote/NSPasteboard+Simplenote.swift b/Simplenote/NSPasteboard+Simplenote.swift index e9a1f2bdf..b9fdd58ca 100644 --- a/Simplenote/NSPasteboard+Simplenote.swift +++ b/Simplenote/NSPasteboard+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSPasteboard + Interlink // extension NSPasteboard { diff --git a/Simplenote/NSProcessInfo+Simplenote.swift b/Simplenote/NSProcessInfo+Simplenote.swift index a6b5c8446..354b15e6e 100644 --- a/Simplenote/NSProcessInfo+Simplenote.swift +++ b/Simplenote/NSProcessInfo+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - ProcessInfo // extension ProcessInfo { diff --git a/Simplenote/NSRange+Simplenote.swift b/Simplenote/NSRange+Simplenote.swift index 33325ecae..c52915766 100644 --- a/Simplenote/NSRange+Simplenote.swift +++ b/Simplenote/NSRange+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSRange Simplenote Methods // extension NSRange { diff --git a/Simplenote/NSRegularExpression+Simplenote.swift b/Simplenote/NSRegularExpression+Simplenote.swift index 3da95df7d..703ed8b63 100644 --- a/Simplenote/NSRegularExpression+Simplenote.swift +++ b/Simplenote/NSRegularExpression+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSRegularExpression Simplenote Methods // extension NSRegularExpression { diff --git a/Simplenote/NSScreen+Simplenote.swift b/Simplenote/NSScreen+Simplenote.swift index 4be5942ce..111a0e634 100644 --- a/Simplenote/NSScreen+Simplenote.swift +++ b/Simplenote/NSScreen+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSScreen Simplenote Methods // extension NSScreen { diff --git a/Simplenote/NSScrollView+Simplenote.swift b/Simplenote/NSScrollView+Simplenote.swift index a20741394..8644e1591 100644 --- a/Simplenote/NSScrollView+Simplenote.swift +++ b/Simplenote/NSScrollView+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - NSScrollView + Simplenote // extension NSScrollView { diff --git a/Simplenote/NSSearchField+Simplenote.swift b/Simplenote/NSSearchField+Simplenote.swift index 0108016ab..99e3d7ec0 100644 --- a/Simplenote/NSSearchField+Simplenote.swift +++ b/Simplenote/NSSearchField+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSSearchField Methods // extension NSSearchField { diff --git a/Simplenote/NSSortDescriptor+Simplenote.swift b/Simplenote/NSSortDescriptor+Simplenote.swift index ad7e0ff9e..bc6deff97 100644 --- a/Simplenote/NSSortDescriptor+Simplenote.swift +++ b/Simplenote/NSSortDescriptor+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SortMode List Methods // extension NSSortDescriptor { diff --git a/Simplenote/NSStoryboard+Simplenote.swift b/Simplenote/NSStoryboard+Simplenote.swift index 1e9d9a609..6d857f347 100644 --- a/Simplenote/NSStoryboard+Simplenote.swift +++ b/Simplenote/NSStoryboard+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSStoryboard: Helper API(s) // extension NSStoryboard { @@ -22,7 +21,6 @@ extension NSStoryboard { } } - // MARK: - NSStoryboard.Name // extension NSStoryboard.Name { @@ -30,7 +28,6 @@ extension NSStoryboard.Name { static let preferences = "Preferences" } - // MARK: - NSStoryboard.SceneIdentifier + NSViewController // extension NSViewController { @@ -40,7 +37,6 @@ extension NSViewController { } } - // MARK: - NSStoryboard.SceneIdentifier + NSWindowController // extension NSWindowController { @@ -49,4 +45,3 @@ extension NSWindowController { classNameWithoutNamespaces } } - diff --git a/Simplenote/NSString+Simplenote.swift b/Simplenote/NSString+Simplenote.swift index 78724a113..d27fd8bd6 100644 --- a/Simplenote/NSString+Simplenote.swift +++ b/Simplenote/NSString+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote API // extension NSString { @@ -82,7 +81,6 @@ extension NSString { } } - // MARK: - Lists Convenience API // extension NSString { @@ -122,7 +120,6 @@ extension NSString { } } - // MARK: - Constants // extension NSString { diff --git a/Simplenote/NSTableView+Simplenote.swift b/Simplenote/NSTableView+Simplenote.swift index 18ea6630a..0e9c9beee 100644 --- a/Simplenote/NSTableView+Simplenote.swift +++ b/Simplenote/NSTableView+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSTableView+Simplenote // extension NSTableView { diff --git a/Simplenote/NSTableViewCell+Simplenote.swift b/Simplenote/NSTableViewCell+Simplenote.swift index 21cf8b075..d52af58be 100644 --- a/Simplenote/NSTableViewCell+Simplenote.swift +++ b/Simplenote/NSTableViewCell+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - /// NSTableCellView Helpers /// extension NSTableCellView { diff --git a/Simplenote/NSTextStorage+Simplenote.swift b/Simplenote/NSTextStorage+Simplenote.swift index 686a4971c..afdc058e6 100644 --- a/Simplenote/NSTextStorage+Simplenote.swift +++ b/Simplenote/NSTextStorage+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSTextStorage // extension NSTextStorage { diff --git a/Simplenote/NSTextView+Simplenote.swift b/Simplenote/NSTextView+Simplenote.swift index 184aca04c..7d7cf9eef 100644 --- a/Simplenote/NSTextView+Simplenote.swift +++ b/Simplenote/NSTextView+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote API // extension NSTextView { @@ -63,7 +62,6 @@ extension NSTextView { } } - // MARK: - Private! // private extension NSTextView { @@ -112,7 +110,6 @@ private extension NSTextView { } } - // MARK: - I/O // extension NSTextView { @@ -140,7 +137,6 @@ extension NSTextView { } } - // MARK: - Linkification // extension NSTextView { @@ -185,7 +181,6 @@ extension NSTextView { } } - // MARK: - Processing Special Characters // extension NSTextView { @@ -216,12 +211,12 @@ extension NSTextView { guard let rangeOfListMarker = lineString.rangeOfListMarker, rangeOfListMarker.location > 0 else { return false } - + // Make sure there is a Tab character at the beginning of the line if !lineString.hasPrefix(String.tab) { return false } - + // Delete the Tab character at the beginning of the line let deletionRange = NSRange(location: lineRange.location, length: 1) insertText("", replacementRange: deletionRange) @@ -284,7 +279,6 @@ extension NSTextView { } } - // MARK: - New Lists // extension NSTextView { @@ -305,7 +299,6 @@ extension NSTextView { } } - // MARK: - Interlinks // extension NSTextView { @@ -320,7 +313,6 @@ extension NSTextView { } } - // MARK: - Geometry // extension NSTextView { @@ -375,4 +367,3 @@ extension NSTextView { scrollRangeToVisible(NSRange(location: location, length: .zero)) } } - diff --git a/Simplenote/NSUserInterfaceItemIdentifier+Simplenote.swift b/Simplenote/NSUserInterfaceItemIdentifier+Simplenote.swift index 5c58792e0..f06b7143e 100644 --- a/Simplenote/NSUserInterfaceItemIdentifier+Simplenote.swift +++ b/Simplenote/NSUserInterfaceItemIdentifier+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote Extensible Constants // extension NSUserInterfaceItemIdentifier { diff --git a/Simplenote/NSView+Simplenote.swift b/Simplenote/NSView+Simplenote.swift index 402f4e62f..b7cebdcb6 100644 --- a/Simplenote/NSView+Simplenote.swift +++ b/Simplenote/NSView+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSView + Simplenote // extension NSView { diff --git a/Simplenote/NSVisualEffectView+Simplenote.swift b/Simplenote/NSVisualEffectView+Simplenote.swift index 40d97898d..21cc275b8 100644 --- a/Simplenote/NSVisualEffectView+Simplenote.swift +++ b/Simplenote/NSVisualEffectView+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - NSVisualEffectView.Material // extension NSVisualEffectView.Material { @@ -24,4 +23,3 @@ extension NSVisualEffectView { .simplenoteTaglistMaterial } } - diff --git a/Simplenote/NSWindow+Simplenote.swift b/Simplenote/NSWindow+Simplenote.swift index c9edf1121..aa16e3427 100644 --- a/Simplenote/NSWindow+Simplenote.swift +++ b/Simplenote/NSWindow+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSWindow + Simplenote // extension NSWindow { diff --git a/Simplenote/NSWindow+Transitions.swift b/Simplenote/NSWindow+Transitions.swift index 055bf423d..3ff16007d 100644 --- a/Simplenote/NSWindow+Transitions.swift +++ b/Simplenote/NSWindow+Transitions.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSWindow / Transitons // extension NSWindow { diff --git a/Simplenote/NSWindowFrameAutosaveName+Simplenote.swift b/Simplenote/NSWindowFrameAutosaveName+Simplenote.swift index bc62145c9..821565c09 100644 --- a/Simplenote/NSWindowFrameAutosaveName+Simplenote.swift +++ b/Simplenote/NSWindowFrameAutosaveName+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NSWindow.FrameAutosaveName // extension NSWindow.FrameAutosaveName { diff --git a/Simplenote/Note+Interlinks.swift b/Simplenote/Note+Interlinks.swift index 33a4c47dd..3eb8e6738 100644 --- a/Simplenote/Note+Interlinks.swift +++ b/Simplenote/Note+Interlinks.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Note + Interlink // extension Note { diff --git a/Simplenote/Note+Simplenote.swift b/Simplenote/Note+Simplenote.swift index b07bae59a..d4e3cec9e 100644 --- a/Simplenote/Note+Simplenote.swift +++ b/Simplenote/Note+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Helpers // extension Note { @@ -48,7 +47,6 @@ extension Note { } } - // MARK: - Excerpt // extension Note { @@ -78,7 +76,6 @@ extension Note { } } - // MARK: - Constants // private struct Constants { diff --git a/Simplenote/NoteEditorViewController+Swift.swift b/Simplenote/NoteEditorViewController+Swift.swift index 089ba3aa4..bdc148cbc 100644 --- a/Simplenote/NoteEditorViewController+Swift.swift +++ b/Simplenote/NoteEditorViewController+Swift.swift @@ -3,7 +3,6 @@ import SimplenoteFoundation import SimplenoteInterlinks import SimplenoteSearch - // MARK: - EditorControllerDelegate // @objc @@ -11,7 +10,6 @@ protocol EditorControllerDelegate: AnyObject { func editorController(_ controller: NoteEditorViewController, updatedNoteContents: Note) } - // MARK: - Interface Initialization // extension NoteEditorViewController { @@ -78,7 +76,6 @@ extension NoteEditorViewController { } } - // MARK: - Public // extension NoteEditorViewController { @@ -105,7 +102,6 @@ extension NoteEditorViewController { } } - // MARK: - Layout // extension NoteEditorViewController { @@ -155,7 +151,6 @@ extension NoteEditorViewController { } } - // MARK: - Display Mode // extension NoteEditorViewController { @@ -216,7 +211,6 @@ extension NoteEditorViewController { } } - // MARK: - Internal State // extension NoteEditorViewController { @@ -266,7 +260,6 @@ extension NoteEditorViewController { } } - // MARK: - Refreshing Interface // extension NoteEditorViewController { @@ -361,7 +354,6 @@ extension NoteEditorViewController { } } - // MARK: - Search API(s) // extension NoteEditorViewController { @@ -372,7 +364,6 @@ extension NoteEditorViewController { } } - // MARK: - NSMenuItemValidation // extension NoteEditorViewController: NSMenuItemValidation { @@ -508,7 +499,6 @@ extension NoteEditorViewController: NSMenuItemValidation { } } - // MARK: - Actions // extension NoteEditorViewController { @@ -573,7 +563,6 @@ extension NoteEditorViewController { } } - // MARK: - Popovers / Pickers // extension NoteEditorViewController { @@ -620,7 +609,6 @@ extension NoteEditorViewController { } } - // MARK: - Markdown Rendering // extension NoteEditorViewController { @@ -659,7 +647,6 @@ extension NoteEditorViewController { } } - // MARK: - Notifications // extension NoteEditorViewController { @@ -709,7 +696,6 @@ extension NoteEditorViewController { } } - // MARK: - TagsFieldDelegate // extension NoteEditorViewController: TagsFieldDelegate { @@ -755,7 +741,6 @@ extension NoteEditorViewController: TagsFieldDelegate { } } - // MARK: - Tags Processing // extension NoteEditorViewController { @@ -797,7 +782,6 @@ extension NoteEditorViewController { } } - // MARK: - PublishViewControllerDelegate // extension NoteEditorViewController: PublishViewControllerDelegate { @@ -823,7 +807,6 @@ extension NoteEditorViewController: PublishViewControllerDelegate { } } - // MARK: - VersionsViewControllerDelegate // extension NoteEditorViewController: VersionsViewControllerDelegate { @@ -857,7 +840,6 @@ extension NoteEditorViewController: VersionsViewControllerDelegate { } } - // MARK: - MetricsControllerDelegate // extension NoteEditorViewController: MetricsControllerDelegate { @@ -876,7 +858,6 @@ extension NoteEditorViewController: MetricsControllerDelegate { } } - // MARK: - Content and Highlights // extension NoteEditorViewController { @@ -916,7 +897,6 @@ extension NoteEditorViewController { } } - // MARK: - Search Map // extension NoteEditorViewController { @@ -941,7 +921,6 @@ extension NoteEditorViewController { } } - // MARK: - Shortcuts // extension NoteEditorViewController { @@ -959,7 +938,6 @@ extension NoteEditorViewController { } } - // MARK: - Editor Metadata // extension NoteEditorViewController { @@ -999,7 +977,6 @@ extension NoteEditorViewController { } } - // MARK: - Interlinks Insertion // extension NoteEditorViewController: InterlinkProcessorDelegate { @@ -1010,7 +987,6 @@ extension NoteEditorViewController: InterlinkProcessorDelegate { } } - // MARK: - EditorMetrics // private enum EditorMetrics { diff --git a/Simplenote/NoteListController.swift b/Simplenote/NoteListController.swift index 58fdb7905..0a6c20aa5 100644 --- a/Simplenote/NoteListController.swift +++ b/Simplenote/NoteListController.swift @@ -3,7 +3,6 @@ import CoreData import SimplenoteFoundation import SimplenoteSearch - // MARK: - NoteListController // class NoteListController: NSObject { @@ -47,7 +46,6 @@ class NoteListController: NSObject { /// var onDidChangeContent: ((_ rowsChangeset: ResultsObjectsChangeset) -> Void)? - /// Designated Initializer /// init(viewContext: NSManagedObjectContext) { @@ -57,7 +55,6 @@ class NoteListController: NSObject { } } - // MARK: - Public API // extension NoteListController { @@ -121,7 +118,6 @@ extension NoteListController { } } - // MARK: - Private API: ResultsController Refreshing // private extension NoteListController { @@ -140,7 +136,6 @@ private extension NoteListController { } } - // MARK: - Private API // private extension NoteListController { diff --git a/Simplenote/NoteListFilter.swift b/Simplenote/NoteListFilter.swift index faa0ec505..a913132e7 100644 --- a/Simplenote/NoteListFilter.swift +++ b/Simplenote/NoteListFilter.swift @@ -1,7 +1,6 @@ import Foundation import SimplenoteSearch - // MARK: - NoteListFilter // enum NoteListFilter: Equatable { @@ -12,7 +11,6 @@ enum NoteListFilter: Equatable { case search(query: SearchQuery) } - // MARK: - NoteListFilter: Public API // extension NoteListFilter { diff --git a/Simplenote/NoteListPrefixFormatter.swift b/Simplenote/NoteListPrefixFormatter.swift index a29053cd2..6ff0a257c 100644 --- a/Simplenote/NoteListPrefixFormatter.swift +++ b/Simplenote/NoteListPrefixFormatter.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NoteListPrefixFormatter // struct NoteListPrefixFormatter { diff --git a/Simplenote/NoteListViewController.swift b/Simplenote/NoteListViewController.swift index 8f46b1f5e..dc24f2cc5 100644 --- a/Simplenote/NoteListViewController.swift +++ b/Simplenote/NoteListViewController.swift @@ -1,7 +1,6 @@ import Foundation import SimplenoteSearch - // MARK: - NotesControllerDelegate // protocol NotesControllerDelegate: AnyObject { @@ -11,7 +10,6 @@ protocol NotesControllerDelegate: AnyObject { func notesControllerDidSelectZeroNotes(_ controller: NoteListViewController) } - // MARK: - NoteListViewController // class NoteListViewController: NSViewController { @@ -59,7 +57,6 @@ class NoteListViewController: NSViewController { /// weak var delegate: NotesControllerDelegate? - var isActive: Bool = false { didSet { if isActive && searchField.currentEditor() != nil { @@ -74,7 +71,6 @@ class NoteListViewController: NSViewController { } } - // MARK: - ViewController Lifecycle deinit { @@ -126,7 +122,6 @@ class NoteListViewController: NSViewController { } } - // MARK: - Keyboard Shortcuts // extension NoteListViewController { @@ -146,7 +141,6 @@ extension NoteListViewController { } } - // MARK: - Public // extension NoteListViewController { @@ -173,7 +167,6 @@ extension NoteListViewController { } } - // MARK: - Interface Initialization // private extension NoteListViewController { @@ -222,7 +215,6 @@ private extension NoteListViewController { } } - // MARK: - Skinning // extension NoteListViewController { @@ -242,7 +234,6 @@ extension NoteListViewController { } } - // MARK: - Layout // extension NoteListViewController { @@ -291,7 +282,6 @@ extension NoteListViewController { } } - // MARK: - Dynamic Properties // private extension NoteListViewController { @@ -321,7 +311,6 @@ private extension NoteListViewController { } } - // MARK: - ListController API(s) 🤟 // private extension NoteListViewController { @@ -357,7 +346,6 @@ private extension NoteListViewController { } } - // MARK: - Refreshing // private extension NoteListViewController { @@ -433,7 +421,6 @@ private extension NoteListViewController { } } - // MARK: - Filtering // private extension NoteListViewController { @@ -458,7 +445,6 @@ private extension NoteListViewController { } } - // MARK: - Row Selection API(s) // extension NoteListViewController { @@ -514,7 +500,6 @@ extension NoteListViewController { } } - // MARK: - Header // private extension NoteListViewController { @@ -532,7 +517,6 @@ private extension NoteListViewController { } } - // MARK: - NSTableViewDelegate // extension NoteListViewController: SPTableViewDelegate { @@ -580,7 +564,6 @@ extension NoteListViewController: SPTableViewDelegate { } } - // MARK: - NSTableViewDataSource // extension NoteListViewController: NSTableViewDataSource { @@ -600,7 +583,6 @@ extension NoteListViewController: NSTableViewDataSource { } } - // MARK: - NSTableViewDelegate Helpers // private extension NoteListViewController { @@ -632,7 +614,6 @@ private extension NoteListViewController { } } - // MARK: - EditorControllerNoteActionsDelegate // extension NoteListViewController: EditorControllerNoteActionsDelegate { @@ -655,7 +636,6 @@ extension NoteListViewController: EditorControllerNoteActionsDelegate { } } - // MARK: - Public Search API // extension NoteListViewController { @@ -676,7 +656,6 @@ extension NoteListViewController { } } - // MARK: - Search Action // extension NoteListViewController { @@ -689,7 +668,6 @@ extension NoteListViewController { } } - // MARK: - MenuItem(s) Validation // extension NoteListViewController: NSMenuItemValidation { @@ -767,7 +745,6 @@ extension NoteListViewController: NSMenuItemValidation { } } - // MARK: - Notifications // extension NoteListViewController { @@ -815,7 +792,6 @@ extension NoteListViewController { } } - // MARK: - Actions // extension NoteListViewController { diff --git a/Simplenote/NoteMetrics.swift b/Simplenote/NoteMetrics.swift index 0cd6ad2c2..f7c2ae30d 100644 --- a/Simplenote/NoteMetrics.swift +++ b/Simplenote/NoteMetrics.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NoteMetrics // struct NoteMetrics { @@ -21,7 +20,6 @@ struct NoteMetrics { /// let modifiedDate: String? - /// Designed Initializer /// - Parameter notes: Notes from which we should extract metrics /// diff --git a/Simplenote/NoteTableCellView.swift b/Simplenote/NoteTableCellView.swift index 5675ffe15..04e0c0c29 100644 --- a/Simplenote/NoteTableCellView.swift +++ b/Simplenote/NoteTableCellView.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - TagTableCellView // @objcMembers @@ -94,7 +93,6 @@ class NoteTableCellView: NSTableCellView { /// var keywords: [String]? - // MARK: - Overridden Methods override func awakeFromNib() { @@ -109,7 +107,6 @@ class NoteTableCellView: NSTableCellView { } } - // MARK: - Public API(s) // extension NoteTableCellView { @@ -140,7 +137,6 @@ extension NoteTableCellView { } } - // MARK: - String Builders // private extension NoteTableCellView { @@ -177,7 +173,6 @@ private extension NoteTableCellView { } } - // MARK: - Selection Workaround // private extension NoteTableCellView { @@ -191,7 +186,6 @@ private extension NoteTableCellView { } } - // MARK: - Interface Initialization // private extension NoteTableCellView { @@ -211,7 +205,6 @@ private extension NoteTableCellView { } } - // MARK: - Interface Initialization // extension NoteTableCellView { @@ -234,7 +227,6 @@ extension NoteTableCellView { } } - // MARK: - Metrics! // private enum Metrics { @@ -246,7 +238,6 @@ private enum Metrics { static let outerVerticalStackViewSpacing = CGFloat(2) } - // MARK: - Interface Settings // private enum Fonts { @@ -258,7 +249,6 @@ private enum Fonts { static let bodyPrefix = NSFont.systemFont(ofSize: 12, weight: .semibold) } - // MARK: - AttributedStrings Helpers // extension NSAttributedString { diff --git a/Simplenote/NumberFormatter+Simplenote.swift b/Simplenote/NumberFormatter+Simplenote.swift index 40cc4d8a3..73548dc37 100644 --- a/Simplenote/NumberFormatter+Simplenote.swift +++ b/Simplenote/NumberFormatter+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - NumberFormatter // extension NumberFormatter { diff --git a/Simplenote/Options.swift b/Simplenote/Options.swift index be2f904fc..00f127308 100644 --- a/Simplenote/Options.swift +++ b/Simplenote/Options.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Wraps access to all of the UserDefault Values // @objcMembers @@ -14,7 +13,6 @@ class Options: NSObject { /// private let defaults: UserDefaults - /// Designated Initializer /// /// - Note: Should be *private*, but for unit testing purposes, we're opening this up. @@ -32,7 +30,6 @@ class Options: NSObject { } } - // MARK: - Actual Options! // extension Options { @@ -145,7 +142,6 @@ extension Options { } } - // MARK: - Migrations // private extension Options { diff --git a/Simplenote/PopoverWindow.swift b/Simplenote/PopoverWindow.swift index 0246e0099..1a9166877 100644 --- a/Simplenote/PopoverWindow.swift +++ b/Simplenote/PopoverWindow.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - AutocompleteWindow // // This class renders a PopoverWindow: the Parent Window is expected to rely events via the `ParentWindowDelegate` protocol. @@ -13,7 +12,6 @@ class PopoverWindow: Window { } - // MARK: - ParentWindowDelegate // extension PopoverWindow: ParentWindowDelegate { @@ -39,7 +37,6 @@ extension PopoverWindow: ParentWindowDelegate { } } - // MARK: - Private API(s) // private extension PopoverWindow { diff --git a/Simplenote/PopoverWindowController.swift b/Simplenote/PopoverWindowController.swift index 685adfef3..09cf04414 100644 --- a/Simplenote/PopoverWindowController.swift +++ b/Simplenote/PopoverWindowController.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - PopoverWindowController // class PopoverWindowController: NSWindowController { @@ -19,7 +18,6 @@ class PopoverWindowController: NSWindowController { } } - // MARK: - Public API // extension PopoverWindowController { @@ -52,7 +50,6 @@ extension PopoverWindowController { } } - // MARK: - Private API(s) // private extension PopoverWindowController { @@ -87,7 +84,6 @@ private extension PopoverWindowController { } } - // MARK: - Metrics // private enum Metrics { diff --git a/Simplenote/PreferencesViewController.swift b/Simplenote/PreferencesViewController.swift index 99236ea9f..f8850e5ea 100644 --- a/Simplenote/PreferencesViewController.swift +++ b/Simplenote/PreferencesViewController.swift @@ -8,7 +8,7 @@ class PreferencesViewController: NSViewController { @IBOutlet private var backgroundview: BackgroundView! // MARK: Labels - + @IBOutlet private var emailLabel: NSTextField! @IBOutlet private var accountTitleLabel: NSTextField! @IBOutlet private var sortOrderLabel: NSTextField! @@ -33,13 +33,12 @@ class PreferencesViewController: NSViewController { @IBOutlet private var textSizeSlider: NSSlider! @IBOutlet private var shareAnalyticsCheckbox: NSButton! - // Mark: Background Views + // MARK: Background Views @IBOutlet private var accountSectionBackground: BackgroundView! @IBOutlet private var layoutSectionBackground: BackgroundView! @IBOutlet private var themeSectionBackground: BackgroundView! @IBOutlet private var textSectionBackground: BackgroundView! - // MARK: View Life Cycle override func viewDidLoad() { @@ -78,12 +77,12 @@ class PreferencesViewController: NSViewController { private func refreshStyle() { backgroundview.fillColor = .simplenoteStatusBarBackgroundColor - let allBackgrounds = [accountSectionBackground, layoutSectionBackground, themeSectionBackground,textSectionBackground] + let allBackgrounds = [accountSectionBackground, layoutSectionBackground, themeSectionBackground, textSectionBackground] allBackgrounds.forEach { $0?.drawsBottomBorder = true $0?.borderColor = .simplenotePreferencesDividerColor } - + let allLabels = [emailLabel, accountTitleLabel, sortOrderLabel, lineLengthLabel, themeLabel, textSizeLabel, littleALabel, bigALabel, analyticsDescriptionLabel, privacyLinkLabel] allLabels.forEach { $0?.textColor = NSColor.simplenoteTextColor } @@ -284,7 +283,6 @@ class PreferencesViewController: NSViewController { Options.shared.fontSize = CGFloat(sender.floatValue) } - // MARK: Analytics Settings @IBAction private func shareAnalyticsWasPressed(_ sender: Any) { @@ -322,8 +320,8 @@ private struct Strings { let link = NSMutableAttributedString(string: linkText) link.addAttributes([ - .link : "https://automattic.com/privacy/", - .font : NSFont.systemFont(ofSize: 13) + .link: "https://automattic.com/privacy/", + .font: NSFont.systemFont(ofSize: 13) ], range: link.fullRange) return link diff --git a/Simplenote/PrivacyViewController.swift b/Simplenote/PrivacyViewController.swift index 8c98f7db6..b67ce4df1 100644 --- a/Simplenote/PrivacyViewController.swift +++ b/Simplenote/PrivacyViewController.swift @@ -1,6 +1,5 @@ import Cocoa - /// Displays the Privacy Settings /// class PrivacyViewController: NSViewController { @@ -47,7 +46,6 @@ class PrivacyViewController: NSViewController { Options.shared.analyticsEnabled } - // MARK: - Overridden Methods override func viewDidLoad() { @@ -86,7 +84,6 @@ class PrivacyViewController: NSViewController { } } - // MARK: - Actions // extension PrivacyViewController { diff --git a/Simplenote/PublishViewController.swift b/Simplenote/PublishViewController.swift index b973a8da4..23b27d52b 100644 --- a/Simplenote/PublishViewController.swift +++ b/Simplenote/PublishViewController.swift @@ -1,7 +1,6 @@ import Foundation import SimplenoteFoundation - // MARK: - Represents the PublishViewController's Internal State // enum PublishState { @@ -11,7 +10,6 @@ enum PublishState { case unpublished } - // MARK: - VersionsViewControllerDelegate // protocol PublishViewControllerDelegate: AnyObject { @@ -19,7 +17,6 @@ protocol PublishViewControllerDelegate: AnyObject { func publishControllerDidClickUnpublish(_ controller: PublishViewController) } - // MARK: - PublishViewController // @objcMembers @@ -53,7 +50,6 @@ class PublishViewController: NSViewController { } } - /// Internal State /// private var state: PublishState = .unpublishing { @@ -66,8 +62,7 @@ class PublishViewController: NSViewController { /// weak var delegate: PublishViewControllerDelegate? - - // MARK - View Lifecycle + // MARK: - View Lifecycle deinit { NotificationCenter.default.removeObserver(self) @@ -85,7 +80,6 @@ class PublishViewController: NSViewController { fatalError("init(coder:) has not been implemented") } - override func viewDidLoad() { super.viewDidLoad() startListeningToNotifications() @@ -95,7 +89,6 @@ class PublishViewController: NSViewController { } } - // MARK: - Actions // extension PublishViewController { @@ -114,7 +107,6 @@ extension PublishViewController { } } - // MARK: - Initialization // private extension PublishViewController { @@ -124,7 +116,6 @@ private extension PublishViewController { } } - // MARK: - Style // private extension PublishViewController { @@ -167,7 +158,6 @@ private extension PublishViewController { } } - // MARK: - Private // private extension PublishViewController { @@ -208,7 +198,6 @@ private extension PublishViewController { } } - // MARK: - NSPopoverDelegate // extension PublishViewController: NSPopoverDelegate { @@ -218,7 +207,6 @@ extension PublishViewController: NSPopoverDelegate { } } - // MARK: - EntityObserverDelegate // extension PublishViewController: EntityObserverDelegate { @@ -228,7 +216,6 @@ extension PublishViewController: EntityObserverDelegate { } } - // MARK: - Constants // private enum Constants { diff --git a/Simplenote/ReferenceTableViewCell.swift b/Simplenote/ReferenceTableViewCell.swift index a668644f4..cb729875f 100644 --- a/Simplenote/ReferenceTableViewCell.swift +++ b/Simplenote/ReferenceTableViewCell.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - ReferenceTableViewCell // class ReferenceTableViewCell: NSTableCellView { @@ -44,7 +43,6 @@ class ReferenceTableViewCell: NSTableCellView { } } - // MARK: - Private API(s) // private extension ReferenceTableViewCell { diff --git a/Simplenote/SPAboutTextField.swift b/Simplenote/SPAboutTextField.swift index bec91853a..d869d6b4c 100644 --- a/Simplenote/SPAboutTextField.swift +++ b/Simplenote/SPAboutTextField.swift @@ -12,5 +12,5 @@ import Cocoa override func resetCursorRects() { self.addCursorRect(self.bounds, cursor: NSCursor.pointingHand) } - + } diff --git a/Simplenote/SPApplication.swift b/Simplenote/SPApplication.swift index ecaccfefc..a75130b28 100644 --- a/Simplenote/SPApplication.swift +++ b/Simplenote/SPApplication.swift @@ -1,6 +1,5 @@ import Cocoa - @objc(SPApplication) final class SPApplication: NSApplication { override func sendEvent(_ event: NSEvent) { diff --git a/Simplenote/SPBucket+Simplenote.swift b/Simplenote/SPBucket+Simplenote.swift index 57d9fc893..9ce3926de 100644 --- a/Simplenote/SPBucket+Simplenote.swift +++ b/Simplenote/SPBucket+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simperium + Simplenote API(s) // extension SPBucket { diff --git a/Simplenote/SPExporter.swift b/Simplenote/SPExporter.swift index 776b1ce7c..85d8844d4 100644 --- a/Simplenote/SPExporter.swift +++ b/Simplenote/SPExporter.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote's Note Exporter Tool // @objc @@ -39,7 +38,6 @@ class SPExporter: NSObject { } } - // MARK: - Private Methods // private extension SPExporter { @@ -76,7 +74,6 @@ private extension SPExporter { } } - // MARK: - Constants // private enum Settings { diff --git a/Simplenote/SPTextAttachment.swift b/Simplenote/SPTextAttachment.swift index 49cd5f998..8e9a10d48 100644 --- a/Simplenote/SPTextAttachment.swift +++ b/Simplenote/SPTextAttachment.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SPTextAttachment // @objcMembers @@ -29,7 +28,6 @@ class SPTextAttachment: NSTextAttachment { /// var sizingFont: NSFont? - /// Convenience Initializer /// /// - tintColor: Text Attachment's Tint Color @@ -42,7 +40,6 @@ class SPTextAttachment: NSTextAttachment { } } - // MARK: - Private Methods // private extension SPTextAttachment { @@ -59,7 +56,6 @@ private extension SPTextAttachment { } } - // MARK: - SPTextAttachmentCell // class SPTextAttachmentCell: NSTextAttachmentCell { @@ -90,7 +86,6 @@ class SPTextAttachmentCell: NSTextAttachmentCell { image?.draw(in: cellFrame) } - // MARK: - Private Methods private func bounds(image: NSImage, font: NSFont, lineFragment: NSRect) -> NSRect { diff --git a/Simplenote/SPTextField.swift b/Simplenote/SPTextField.swift index 42c938473..29fb86d68 100644 --- a/Simplenote/SPTextField.swift +++ b/Simplenote/SPTextField.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SPTextFieldDelegate: Our custom protocol. // Why: Because `shouldBeginEditing`'s API requires a non null NSText instance, which we really can't acquire // within `acceptsFirstResponder`. @@ -9,7 +8,6 @@ protocol SPTextFieldDelegate: NSTextFieldDelegate { func controlAcceptsFirstResponder(_ control: NSControl) -> Bool } - // MARK: - SPTextField // class SPTextField: NSTextField { @@ -56,7 +54,6 @@ class SPTextField: NSTextField { } } - // MARK: - Overridden override var acceptsFirstResponder: Bool { @@ -80,7 +77,6 @@ class SPTextField: NSTextField { } } - // MARK: - Private // private extension SPTextField { diff --git a/Simplenote/SPTextView.swift b/Simplenote/SPTextView.swift index 2f97e070f..6680767c3 100644 --- a/Simplenote/SPTextView.swift +++ b/Simplenote/SPTextView.swift @@ -37,7 +37,7 @@ class SPTextView: NSTextView { } } - override var typingAttributes: [NSAttributedString.Key : Any] { + override var typingAttributes: [NSAttributedString.Key: Any] { get { simplenoteStorage?.typingAttributes ?? super.typingAttributes } @@ -134,7 +134,6 @@ class SPTextView: NSTextView { } } - // MARK: - Relative locations // extension SPTextView { diff --git a/Simplenote/SPTracker+Swift.swift b/Simplenote/SPTracker+Swift.swift index 2eb7a0443..c5c0ba073 100644 --- a/Simplenote/SPTracker+Swift.swift +++ b/Simplenote/SPTracker+Swift.swift @@ -5,7 +5,7 @@ import Foundation extension SPTracker { static func trackSettingsStatusBarDisplayMode(hidden: Bool) { - trackAutomatticEvent(withName: "settings_sort_bar_display_mode", properties: ["hidden" : hidden]) + trackAutomatticEvent(withName: "settings_sort_bar_display_mode", properties: ["hidden": hidden]) } static func trackVerificationReviewScreenViewed() { @@ -38,7 +38,6 @@ extension SPTracker { } } - // MARK: - Shortcuts // extension SPTracker { diff --git a/Simplenote/SPUserInterface.swift b/Simplenote/SPUserInterface.swift index 62e797b89..3ddb4049d 100644 --- a/Simplenote/SPUserInterface.swift +++ b/Simplenote/SPUserInterface.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - Simplenote's Theme // class SPUserInterface: NSObject { @@ -42,7 +41,6 @@ class SPUserInterface: NSObject { } } - // MARK: - Helpers // extension SPUserInterface { diff --git a/Simplenote/SearchField.swift b/Simplenote/SearchField.swift index a003d78b1..d1c5de6f5 100644 --- a/Simplenote/SearchField.swift +++ b/Simplenote/SearchField.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - SearchField // class SearchField: NSSearchField { @@ -30,7 +29,6 @@ class SearchField: NSSearchField { } } - // MARK: - Overridden override func drawFocusRingMask() { @@ -42,7 +40,6 @@ class SearchField: NSSearchField { refreshStyle() } - /// Resets the Style /// - Note: In Mojave / Catalina, this API has the beautiful side effect of going Dark Mode 😬 /// @@ -51,7 +48,6 @@ class SearchField: NSSearchField { } } - // MARK: - Private Methods // private extension SearchField { @@ -69,8 +65,8 @@ private extension SearchField { func refreshPlaceholderStyle() { placeholderAttributedString = NSAttributedString(string: placeholder, attributes: [ - .font: style.placeholderFont, - .foregroundColor: style.placeholderColor + .font: style.placeholderFont, + .foregroundColor: style.placeholderColor ]) } @@ -86,7 +82,6 @@ private extension SearchField { } } - // MARK: - SearchFieldCell // class SearchFieldCell: NSSearchFieldCell { @@ -106,7 +101,6 @@ class SearchFieldCell: NSSearchFieldCell { searchField.style } - // MARK: - Geometry override func drawingRect(forBounds rect: NSRect) -> NSRect { @@ -127,7 +121,6 @@ class SearchFieldCell: NSSearchFieldCell { return output } - // MARK: - Overridden Methods override func draw(withFrame cellFrame: NSRect, in controlView: NSView) { @@ -146,7 +139,6 @@ class SearchFieldCell: NSSearchFieldCell { } } - // MARK: - Private API(s) // private extension SearchFieldCell { @@ -181,20 +173,18 @@ private extension SearchFieldCell { } } - // MARK: - Metrics // struct SearchFieldMetrics { - let borderRadius : CGFloat - let borderWidth : CGFloat + let borderRadius: CGFloat + let borderWidth: CGFloat let highlightBorderWidth: CGFloat let cancelButtonPaddingX: CGFloat - let searchIconSize : NSSize - let searchIconPaddingX : CGFloat - let textPadding : NSEdgeInsets + let searchIconSize: NSSize + let searchIconPaddingX: CGFloat + let textPadding: NSEdgeInsets } - // MARK: - Style // struct SearchFieldStyle { @@ -209,31 +199,30 @@ struct SearchFieldStyle { let searchButtonTintColor: NSColor } - // MARK: - Defaults // extension SearchFieldMetrics { static var `default`: SearchFieldMetrics { - SearchFieldMetrics(borderRadius: 5, - borderWidth: 1, - highlightBorderWidth: 3, - cancelButtonPaddingX: 4, - searchIconSize: NSSize(width: 16, height: 16), - searchIconPaddingX: 9, - textPadding: NSEdgeInsets(top: .zero, left: 28, bottom: .zero, right: 40)) + SearchFieldMetrics(borderRadius: 5, + borderWidth: 1, + highlightBorderWidth: 3, + cancelButtonPaddingX: 4, + searchIconSize: NSSize(width: 16, height: 16), + searchIconPaddingX: 9, + textPadding: NSEdgeInsets(top: .zero, left: 28, bottom: .zero, right: 40)) } } extension SearchFieldStyle { static var `default`: SearchFieldStyle { - SearchFieldStyle(borderColor: .simplenoteSecondaryDividerColor, - highlightBorderColor: .simplenoteSearchBarHighlightedBorderColor, - innerBackgroundColor: .simplenoteSearchBarBackgroundColor, - placeholderFont: .simplenoteSecondaryTextFont, - placeholderColor: .simplenoteSecondaryTextColor, - textColor: .simplenoteTextColor, - textFont: .simplenoteSecondaryTextFont, - searchButtonImage: NSImage(named: .search)!, - searchButtonTintColor: .simplenoteSecondaryTextColor) + SearchFieldStyle(borderColor: .simplenoteSecondaryDividerColor, + highlightBorderColor: .simplenoteSearchBarHighlightedBorderColor, + innerBackgroundColor: .simplenoteSearchBarBackgroundColor, + placeholderFont: .simplenoteSecondaryTextFont, + placeholderColor: .simplenoteSecondaryTextColor, + textColor: .simplenoteTextColor, + textFont: .simplenoteSecondaryTextFont, + searchButtonImage: NSImage(named: .search)!, + searchButtonTintColor: .simplenoteSecondaryTextColor) } } diff --git a/Simplenote/SearchQuery+Simplenote.swift b/Simplenote/SearchQuery+Simplenote.swift index 34e4ba658..2a2dc9c44 100644 --- a/Simplenote/SearchQuery+Simplenote.swift +++ b/Simplenote/SearchQuery+Simplenote.swift @@ -1,7 +1,6 @@ import Foundation import SimplenoteSearch - extension SearchQuery { convenience init(searchText: String) { self.init(searchText: searchText, settings: .default) diff --git a/Simplenote/SeparatorTableViewCell.swift b/Simplenote/SeparatorTableViewCell.swift index d1218c078..8a0728a47 100644 --- a/Simplenote/SeparatorTableViewCell.swift +++ b/Simplenote/SeparatorTableViewCell.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - SeparatorTableViewCell // class SeparatorTableViewCell: NSTableCellView { diff --git a/Simplenote/SignupRemote.swift b/Simplenote/SignupRemote.swift index 7d38c35c0..f41c5a2b2 100644 --- a/Simplenote/SignupRemote.swift +++ b/Simplenote/SignupRemote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SignupRemote // class SignupRemote: Remote { diff --git a/Simplenote/SignupVerificationViewController.swift b/Simplenote/SignupVerificationViewController.swift index fbaac4189..7878e8159 100644 --- a/Simplenote/SignupVerificationViewController.swift +++ b/Simplenote/SignupVerificationViewController.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - SignupVerificationViewController // class SignupVerificationViewController: NSViewController { @@ -20,7 +19,6 @@ class SignupVerificationViewController: NSViewController { /// private let authenticator: SPAuthenticator - /// Designated Initializer /// init(email: String, authenticator: SPAuthenticator) { @@ -34,7 +32,6 @@ class SignupVerificationViewController: NSViewController { fatalError("init(coder:) has not been implemented") } - // MARK: - Overridden Methods override func viewDidLoad() { @@ -50,7 +47,6 @@ class SignupVerificationViewController: NSViewController { } } - // MARK: - Interface // private extension SignupVerificationViewController { @@ -105,7 +101,6 @@ private extension SignupVerificationViewController { } } - // MARK: - Action Handlers // extension SignupVerificationViewController { @@ -125,7 +120,6 @@ extension SignupVerificationViewController { } } - // MARK: - Private API(s) // private extension SignupVerificationViewController { @@ -137,7 +131,6 @@ private extension SignupVerificationViewController { } } - // MARK: - Localization // private enum Localization { @@ -146,7 +139,6 @@ private enum Localization { static let back = NSLocalizedString("Go Back", comment: "Back Button Title") } - private enum Fonts { static let regularMessageFont = NSFont.systemFont(ofSize: 13) static let boldMessageFont = NSFont.boldSystemFont(ofSize: 13) diff --git a/Simplenote/Simperium+Simplenote.swift b/Simplenote/Simperium+Simplenote.swift index 4befa68d5..ad4e2cf25 100644 --- a/Simplenote/Simperium+Simplenote.swift +++ b/Simplenote/Simperium+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simperium + Buckets // extension Simperium { @@ -51,7 +50,6 @@ extension Simperium { } } - // MARK: - Simperium + Tags // extension Simperium { @@ -88,7 +86,6 @@ extension Simperium { } } - // MARK: - Simperium + Notes // extension Simperium { @@ -133,7 +130,6 @@ extension Simperium { } } - // MARK: - Constants // extension Simperium { diff --git a/Simplenote/SimplenoteAppDelegate+Swift.swift b/Simplenote/SimplenoteAppDelegate+Swift.swift index ec1a56b25..0627ebb7d 100644 --- a/Simplenote/SimplenoteAppDelegate+Swift.swift +++ b/Simplenote/SimplenoteAppDelegate+Swift.swift @@ -2,7 +2,6 @@ import Foundation import SimplenoteSearch import Simperium_OSX - // MARK: - Initialization // extension SimplenoteAppDelegate { @@ -123,7 +122,6 @@ extension SimplenoteAppDelegate { } } - // MARK: - Public API // extension SimplenoteAppDelegate { @@ -155,7 +153,6 @@ extension SimplenoteAppDelegate { } } - // MARK: - Actions! // extension SimplenoteAppDelegate { @@ -242,7 +239,6 @@ extension SimplenoteAppDelegate { } } - // MARK: - URL Handlers // extension SimplenoteAppDelegate { @@ -281,7 +277,6 @@ extension SimplenoteAppDelegate { } } - // MARK: - SPBucketDelegate // extension SimplenoteAppDelegate: SPBucketDelegate { @@ -311,7 +306,6 @@ extension SimplenoteAppDelegate: SPBucketDelegate { } } - // MARK: - MenuItem(s) Validation // extension SimplenoteAppDelegate: NSMenuItemValidation { @@ -440,7 +434,6 @@ extension SimplenoteAppDelegate { } } - // MARK: - TagListActionsDelegate Conformance // extension SimplenoteAppDelegate: TagsControllerDelegate { @@ -465,7 +458,6 @@ extension SimplenoteAppDelegate: TagsControllerDelegate { } } - extension SimplenoteAppDelegate: NotesControllerDelegate { func notesController(_ controller: NoteListViewController, didSearch query: SearchQuery?) { @@ -505,7 +497,7 @@ extension SimplenoteAppDelegate { return } - simperium.authenticateIfNecessary() + simperium.authenticateIfNecessary() } @objc @@ -519,8 +511,6 @@ extension SimplenoteAppDelegate { } } - - // MARK: - Constants // private struct Constants { diff --git a/Simplenote/SimplenoteConstants.swift b/Simplenote/SimplenoteConstants.swift index d1f2fa604..2d2aa8b11 100644 --- a/Simplenote/SimplenoteConstants.swift +++ b/Simplenote/SimplenoteConstants.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote Constants! // @objcMembers diff --git a/Simplenote/SortMode.swift b/Simplenote/SortMode.swift index b316f67e2..fe79dc85e 100644 --- a/Simplenote/SortMode.swift +++ b/Simplenote/SortMode.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Sort Modes // enum SortMode: Int, CaseIterable { @@ -21,7 +20,6 @@ enum SortMode: Int, CaseIterable { case modifiedOldest } - // MARK: - Public Methods // extension SortMode { @@ -44,7 +42,6 @@ extension SortMode { } } - // MARK: - Notes List SortMode <> Interface Identifier // extension SortMode { diff --git a/Simplenote/SpacerTableViewCell.swift b/Simplenote/SpacerTableViewCell.swift index fa23cce62..9f2e27d94 100644 --- a/Simplenote/SpacerTableViewCell.swift +++ b/Simplenote/SpacerTableViewCell.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - SpacerTableViewCell: Literally an empty TableViewCell, which allows us to inject spacing // class SpacerTableViewCell: NSTableCellView { diff --git a/Simplenote/SplitItemMetrics.swift b/Simplenote/SplitItemMetrics.swift index 4a8b6fe90..f403a4d74 100644 --- a/Simplenote/SplitItemMetrics.swift +++ b/Simplenote/SplitItemMetrics.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SplitItemMetrics // enum SplitItemMetrics { @@ -13,7 +12,6 @@ enum SplitItemMetrics { private static let editorContentTopInsetLegacy = CGFloat(-10) // Standard (38pt) minus editorContentBottomInset private static let editorContentTopInsetBigSur = CGFloat.zero // Standard (48pt) minus editorContentBottomInset - /// Sidebar Insets: Tags + Notes Lists /// static var sidebarTopInset: CGFloat { diff --git a/Simplenote/SplitView.swift b/Simplenote/SplitView.swift index 9c61ff463..ab075141b 100644 --- a/Simplenote/SplitView.swift +++ b/Simplenote/SplitView.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SplitView // class SplitView: NSSplitView { @@ -20,7 +19,6 @@ class SplitView: NSSplitView { } } - // MARK: - Forced Redraw Hacks. Please Nuke! // private extension SplitView { diff --git a/Simplenote/SplitViewController.swift b/Simplenote/SplitViewController.swift index 88b49518b..d6dbd7f7b 100644 --- a/Simplenote/SplitViewController.swift +++ b/Simplenote/SplitViewController.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - SplitViewController // @objc @@ -37,7 +36,6 @@ class SplitViewController: NSSplitViewController { tagsSplitItem.isCollapsed } - // MARK: - Overridden Methods override func loadView() { @@ -59,7 +57,6 @@ class SplitViewController: NSSplitViewController { } } - // MARK: - Layout // private extension SplitViewController { @@ -89,7 +86,6 @@ private extension SplitViewController { } } - // MARK: - Public API // extension SplitViewController { @@ -145,7 +141,6 @@ extension SplitViewController { } } - // MARK: - Private API(s) // private extension SplitViewController { @@ -185,7 +180,6 @@ private extension SplitViewController { } } - // MARK: - Actions // extension SplitViewController { @@ -217,7 +211,6 @@ extension SplitViewController { } } - // MARK: - SplitState: Represents the Internal SplitView State // private enum SplitState: String { @@ -248,7 +241,6 @@ extension SplitState { } } - // MARK: SplitItemName(s) Enum // enum SplitItemKind: Int, CaseIterable { @@ -257,7 +249,6 @@ enum SplitItemKind: Int, CaseIterable { case editor = 2 } - // MARK: - SplitItemName Properties // extension SplitItemKind { @@ -289,7 +280,6 @@ extension SplitItemKind { } } - // MARK: - ContentView // private class ContentView: NSView { @@ -301,7 +291,6 @@ private class ContentView: NSView { } } - // MARK: - SplitView's Metrics // private enum Metrics { diff --git a/Simplenote/String+Simplenote.swift b/Simplenote/String+Simplenote.swift index 34bf63bf5..afdc3734f 100644 --- a/Simplenote/String+Simplenote.swift +++ b/Simplenote/String+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - String Constants // extension String { @@ -36,7 +35,6 @@ extension String { } } - // MARK: - Helper API(s) // extension String { @@ -93,7 +91,6 @@ extension String { } } - // MARK: - Searching for the first / last characters // extension String { @@ -118,7 +115,6 @@ extension String { } } - // MARK: - Searching for keywords // extension String { diff --git a/Simplenote/TableRowView.swift b/Simplenote/TableRowView.swift index 289268fc6..94a614b7a 100644 --- a/Simplenote/TableRowView.swift +++ b/Simplenote/TableRowView.swift @@ -1,10 +1,9 @@ import Foundation - // MARK: - TableRowView // @objcMembers -class TableRowView : NSTableRowView { +class TableRowView: NSTableRowView { /// Selection's Inner Selection Insets /// @@ -30,7 +29,6 @@ class TableRowView : NSTableRowView { } } - // MARK: - Overridden override func draw(_ dirtyRect: NSRect) { @@ -66,7 +64,6 @@ class TableRowView : NSTableRowView { // NO-OP: Even overriding this API yields a weird effect! } - // MARK: - Drawing func drawSimplenoteSeparator(in rect: NSRect) { @@ -90,8 +87,6 @@ class TableRowView : NSTableRowView { } } - - // MARK: - Defines a TableRowView Presentation Style // enum TableRowStyle { @@ -160,7 +155,6 @@ extension TableRowStyle { } } - // MARK: - Constants // private enum Metrics { diff --git a/Simplenote/TagAttachmentCell.swift b/Simplenote/TagAttachmentCell.swift index c3ebb3fc0..7cf250863 100644 --- a/Simplenote/TagAttachmentCell.swift +++ b/Simplenote/TagAttachmentCell.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - TagAttachmentCell // class TagAttachmentCell: NSTextAttachmentCell { @@ -52,7 +51,6 @@ class TagAttachmentCell: NSTextAttachmentCell { } } - // MARK: - Mouse Handling // extension TagAttachmentCell { @@ -79,7 +77,6 @@ extension TagAttachmentCell { } } - // MARK: - Private API // private extension TagAttachmentCell { @@ -113,20 +110,18 @@ private extension TagAttachmentCell { } } - // MARK: - Dynamic Properties // private extension TagAttachmentCell { var attributes: [NSAttributedString.Key: Any] { [ - .font: NSFont.simplenoteSecondaryTextFont, - .foregroundColor: NSColor.simplenoteTextColor + .font: NSFont.simplenoteSecondaryTextFont, + .foregroundColor: NSColor.simplenoteTextColor ] } } - // MARK: - Drawing Metrics // private enum Metrics { diff --git a/Simplenote/TagListFilter.swift b/Simplenote/TagListFilter.swift index 8902eea8f..8597f570e 100644 --- a/Simplenote/TagListFilter.swift +++ b/Simplenote/TagListFilter.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - TagListFilter // enum TagListFilter: Equatable { @@ -10,7 +9,6 @@ enum TagListFilter: Equatable { case tag(name: String) } - // MARK: - Public API(s) // extension TagListFilter { diff --git a/Simplenote/TagListRow.swift b/Simplenote/TagListRow.swift index 41c770586..9adf0bd41 100644 --- a/Simplenote/TagListRow.swift +++ b/Simplenote/TagListRow.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Tag List Row // enum TagListRow: Equatable { @@ -12,7 +11,6 @@ enum TagListRow: Equatable { case untagged } - // MARK: - Helpers API(s) // extension TagListRow { @@ -60,7 +58,6 @@ extension TagListRow { } } - // MARK: - TagListRow: Filter Mapping // extension TagListRow { diff --git a/Simplenote/TagListState.swift b/Simplenote/TagListState.swift index 78832f301..07c981190 100644 --- a/Simplenote/TagListState.swift +++ b/Simplenote/TagListState.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - List State: Allows us to wrap a native Swift type into an ObjC Property // TODO: Let's remove this the second TagListController is Swift native! // @@ -25,7 +24,6 @@ class TagListState: NSObject { } } - // MARK: - Public API(s) // extension TagListState { diff --git a/Simplenote/TagListViewController+Swift.swift b/Simplenote/TagListViewController+Swift.swift index d432504dd..15896da5b 100644 --- a/Simplenote/TagListViewController+Swift.swift +++ b/Simplenote/TagListViewController+Swift.swift @@ -1,7 +1,5 @@ import Foundation - - // MARK: - TagListDelegate // @objc @@ -11,7 +9,6 @@ protocol TagsControllerDelegate: AnyObject { func tagsControllerDidDeleteTag(_ controller: TagListViewController, name: String) } - // MARK: - Interface Initialization // extension TagListViewController { @@ -33,7 +30,6 @@ extension TagListViewController { } } - // MARK: - Refreshing // extension TagListViewController { @@ -73,7 +69,6 @@ extension TagListViewController { } } - // MARK: - Public API // extension TagListViewController { @@ -105,7 +100,6 @@ extension TagListViewController { } } - // MARK: - Notifications // extension TagListViewController { @@ -164,7 +158,6 @@ extension TagListViewController { } } - // MARK: - NSTableViewDelegate Helpers // extension TagListViewController: NSTableViewDataSource, SPTableViewDelegate { @@ -224,7 +217,6 @@ extension TagListViewController: NSTableViewDataSource, SPTableViewDelegate { } } - // MARK: - NSTableViewDelegate Helpers // extension TagListViewController { @@ -289,7 +281,6 @@ extension TagListViewController { } } - // MARK: - Actions // extension TagListViewController { @@ -304,7 +295,6 @@ extension TagListViewController { } } - // MARK: - Keyboard Navigation // extension TagListViewController { @@ -314,7 +304,6 @@ extension TagListViewController { } } - // MARK: - SPTextFieldDelegate // extension TagListViewController: SPTextFieldDelegate { @@ -324,7 +313,6 @@ extension TagListViewController: SPTextFieldDelegate { } } - // MARK: - Appearance // extension TagListViewController { @@ -335,12 +323,11 @@ extension TagListViewController { } } - // MARK: - Drag/Drop // extension TagListViewController { @objc static let tagDataTypeName = "com.codality.tag" - + public func tableView(_ tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedRow row: Int, @@ -349,52 +336,52 @@ extension TagListViewController { draggingSource != tableView { return [] } - + // Disallow drop outside the Tags Range if row < state.indexOfFirstTagRow || row > state.indexOfLastTagRow + 1 { return [] } - + if dropOperation == .on { tableView.setDropRow(row, dropOperation: .above) } - + return .move } - + public func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? { guard !Options.shared.alphabeticallySortTags, let tag = state.tag(atIndex: row), let payload = try? NSKeyedArchiver.archivedData(withRootObject: [tag.objectID.uriRepresentation()], requiringSecureCoding: false) else { return nil } - + let item = NSPasteboardItem() item.setData(payload, forType: .tag) - + return item } - + public func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableView.DropOperation) -> Bool { // Account for row offset let newRow = row - state.indexOfFirstTagRow - + // Get object URIs from paste board guard let data = info.draggingPasteboard.data(forType: .tag) else { return false } - + guard let objectURIs = try? NSKeyedUnarchiver.unarchivedArrayOfObjects(ofClass: NSURL.self, from: data) else { return false } - + // Get managed object context and persistent store coordinator let context = SimplenoteAppDelegate.shared().managedObjectContext let coordinator = context.persistentStoreCoordinator - + // Collect manged objects with URIs var draggedObjects: Array = objectURIs.compactMap({ guard let objectID = coordinator?.managedObjectID(forURIRepresentation: $0 as URL) else { @@ -425,9 +412,9 @@ extension TagListViewController { } else { allObjects.addObjects(from: draggedObjects) } - + allObjects.remove(NSNull()) - + var counter = 0 for object in allObjects { guard let tag = allObjects[counter] as? Tag else { @@ -436,7 +423,7 @@ extension TagListViewController { tag.index = NSNumber(integerLiteral: counter) counter += 1 } - + // Reload data loadTags() return true diff --git a/Simplenote/TagTableCellView.swift b/Simplenote/TagTableCellView.swift index 40009d49b..449a555f7 100644 --- a/Simplenote/TagTableCellView.swift +++ b/Simplenote/TagTableCellView.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - TagTableCellView // @objcMembers @@ -19,7 +18,6 @@ class TagTableCellView: NSTableCellView { /// private(set) var mouseInside = false - /// Tracking Areas /// private lazy var trackingArea = NSTrackingArea(rect: .zero, options: [.inVisibleRect, .activeAlways, .mouseEnteredAndExited], owner: self, userInfo: nil) @@ -50,7 +48,6 @@ class TagTableCellView: NSTableCellView { } } - // MARK: - Tracking Areas // extension TagTableCellView { @@ -71,7 +68,6 @@ extension TagTableCellView { } } - // MARK: - Styling // private extension TagTableCellView { diff --git a/Simplenote/TagTextFormatter.swift b/Simplenote/TagTextFormatter.swift index 405ab6c8c..4ab408d31 100644 --- a/Simplenote/TagTextFormatter.swift +++ b/Simplenote/TagTextFormatter.swift @@ -1,9 +1,8 @@ import Foundation - // MARK: - TagTextFormatter: Helps us limit the Tag Length in the TagListViewController. // -class TagTextFormatter : Formatter { +class TagTextFormatter: Formatter { /// Maximum Allowed Tag Length /// @@ -55,7 +54,7 @@ class TagTextFormatter : Formatter { return encodedString.count <= maximumLength } - override func attributedString(for obj: Any, withDefaultAttributes attrs: [NSAttributedString.Key : Any]? = nil) -> NSAttributedString? { + override func attributedString(for obj: Any, withDefaultAttributes attrs: [NSAttributedString.Key: Any]? = nil) -> NSAttributedString? { nil } } diff --git a/Simplenote/TagsField.swift b/Simplenote/TagsField.swift index cdeb33d8b..e26fc4394 100644 --- a/Simplenote/TagsField.swift +++ b/Simplenote/TagsField.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - TagsFieldDelegate // protocol TagsFieldDelegate: NSTokenFieldDelegate { @@ -10,7 +9,6 @@ protocol TagsFieldDelegate: NSTokenFieldDelegate { func tokenField(_ tokenField: NSTokenField, didChange tokens: [String]) } - // MARK: - TagsField // @objcMembers @@ -87,7 +85,6 @@ class TagsField: NSTokenField { } } - // MARK: - Initializers override init(frame frameRect: NSRect) { @@ -101,7 +98,6 @@ class TagsField: NSTokenField { } } - // MARK: - Text Edition Overridden API // extension TagsField { @@ -125,7 +121,7 @@ extension TagsField { /// let currentNumberOfTokens = numberOfTokens - if numberOfTokensBeforeEdition != currentNumberOfTokens { + if numberOfTokensBeforeEdition != currentNumberOfTokens { tagsFieldDelegate?.tokenField(self, didChange: tokens) } @@ -145,7 +141,6 @@ extension TagsField { } } - // MARK: - Scroll / Autolayout Support // extension TagsField { @@ -178,7 +173,6 @@ extension TagsField { } } - // MARK: - NSTextViewDelegate // extension TagsField: NSTextViewDelegate { @@ -220,7 +214,6 @@ extension TagsField: NSTextViewDelegate { } } - // MARK: - Cursor Helpers // extension TagsField { @@ -253,7 +246,6 @@ extension TagsField { } } - // MARK: - Mouse Support // private extension TagsField { @@ -309,7 +301,6 @@ private extension TagsField { } } - // MARK: - Placeholder Support // private extension TagsField { @@ -331,7 +322,6 @@ private extension TagsField { } } - // MARK: - Settings // private enum TokenizationSettings { diff --git a/Simplenote/TagsFieldCell.swift b/Simplenote/TagsFieldCell.swift index 9c9501882..99e902945 100644 --- a/Simplenote/TagsFieldCell.swift +++ b/Simplenote/TagsFieldCell.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - TagsFieldCell // class TagsFieldCell: NSTokenFieldCell { @@ -47,7 +46,6 @@ class TagsFieldCell: NSTokenFieldCell { } } - // MARK: - Private API(s) // private extension TagsFieldCell { @@ -118,7 +116,6 @@ private extension TagsFieldCell { } } - // MARK: - NSTextStorageDelegate Conformance // extension TagsFieldCell: NSTextStorageDelegate { diff --git a/Simplenote/TextViewInputHandler.swift b/Simplenote/TextViewInputHandler.swift index 8052756fe..534bdfed3 100644 --- a/Simplenote/TextViewInputHandler.swift +++ b/Simplenote/TextViewInputHandler.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Input Handler: Encapsulates Simplenote's TextView Input Logic // class TextViewInputHandler: NSObject { @@ -9,7 +8,6 @@ class TextViewInputHandler: NSObject { /// private let regexForListMarkers = NSRegularExpression.regexForListMarkers - /// Handles TextView's `shouldChangeTextInRange:string:` Delegate API: /// /// - Note: diff --git a/Simplenote/ThemeOption.swift b/Simplenote/ThemeOption.swift index 54778a7de..d3bb4aa7f 100644 --- a/Simplenote/ThemeOption.swift +++ b/Simplenote/ThemeOption.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Represents a Theme Menu Option // enum ThemeOption: Int, CaseIterable { @@ -9,7 +8,6 @@ enum ThemeOption: Int, CaseIterable { case system = 2 } - // MARK: - Properties // extension ThemeOption { diff --git a/Simplenote/ToolbarState.swift b/Simplenote/ToolbarState.swift index 7974a3087..0ba599fe0 100644 --- a/Simplenote/ToolbarState.swift +++ b/Simplenote/ToolbarState.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - ToolbarState: Encapsulates all of the logic that determines the inner Toolbar State // struct ToolbarState { @@ -30,7 +29,6 @@ struct ToolbarState { let isViewingTrash: Bool } - // MARK: - Derived Properties // extension ToolbarState { @@ -77,7 +75,6 @@ extension ToolbarState { } } - // MARK: - Default State // extension ToolbarState { diff --git a/Simplenote/ToolbarView.swift b/Simplenote/ToolbarView.swift index c9eec85e8..40950cdba 100644 --- a/Simplenote/ToolbarView.swift +++ b/Simplenote/ToolbarView.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - ToolbarView // @objcMembers @@ -27,7 +26,6 @@ class ToolbarView: NSView { } } - // MARK: - Overridden override func awakeFromNib() { @@ -50,7 +48,6 @@ class ToolbarView: NSView { } } - // MARK: - State Management // private extension ToolbarView { @@ -74,7 +71,6 @@ private extension ToolbarView { } } - // MARK: - Theming // private extension ToolbarView { diff --git a/Simplenote/URL+Interlink.swift b/Simplenote/URL+Interlink.swift index 1a1a2a0f0..dd342ae28 100644 --- a/Simplenote/URL+Interlink.swift +++ b/Simplenote/URL+Interlink.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - URL + Interlink // extension URL { diff --git a/Simplenote/UnicodeScalar+Simplenote.swift b/Simplenote/UnicodeScalar+Simplenote.swift index 8509d9a23..acba5436e 100644 --- a/Simplenote/UnicodeScalar+Simplenote.swift +++ b/Simplenote/UnicodeScalar+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - UnicodeScalar Simplenote Methods // extension UnicodeScalar { diff --git a/Simplenote/UserDefaults+Simplenote.swift b/Simplenote/UserDefaults+Simplenote.swift index 134b28604..34c6f213f 100644 --- a/Simplenote/UserDefaults+Simplenote.swift +++ b/Simplenote/UserDefaults+Simplenote.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Simplenote UserDefaults Keys // extension UserDefaults { @@ -18,7 +17,6 @@ extension UserDefaults { } } - // MARK: - Convenience Methods // extension UserDefaults { diff --git a/Simplenote/Version.swift b/Simplenote/Version.swift index bbe6cddc8..5051ff6d9 100644 --- a/Simplenote/Version.swift +++ b/Simplenote/Version.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - Version // struct Version { @@ -17,7 +16,6 @@ struct Version { /// let modificationDate: Date - /// Designed Initializer /// init?(version: String, payload: [AnyHashable: Any]) { @@ -33,7 +31,6 @@ struct Version { } } - // MARK: - Parsing Keys // extension Version { diff --git a/Simplenote/VersionsController.swift b/Simplenote/VersionsController.swift index 11923d74a..cd81a46d0 100644 --- a/Simplenote/VersionsController.swift +++ b/Simplenote/VersionsController.swift @@ -1,7 +1,6 @@ import Foundation import os.log - // MARK: - VersionsController // class VersionsController: NSObject { @@ -14,7 +13,6 @@ class VersionsController: NSObject { /// let simperium: Simperium - /// Designated Initializer /// init(simperium: Simperium) { @@ -22,7 +20,6 @@ class VersionsController: NSObject { super.init() } - /// Requests the specified number of versions of Notes for a given SimperiumKey. /// /// - Parameters: @@ -50,7 +47,6 @@ class VersionsController: NSObject { } } - // MARK: - Simperium // extension VersionsController { @@ -72,7 +68,6 @@ extension VersionsController { } } - // MARK: - ListenerWrapper // private class ListenerWrapper: NSObject { diff --git a/Simplenote/VersionsViewController.swift b/Simplenote/VersionsViewController.swift index 9464e38dc..e4e4d2fdf 100644 --- a/Simplenote/VersionsViewController.swift +++ b/Simplenote/VersionsViewController.swift @@ -2,7 +2,6 @@ import Foundation import AppKit import os.log - // MARK: - VersionsViewControllerDelegate // protocol VersionsViewControllerDelegate: AnyObject { @@ -12,7 +11,6 @@ protocol VersionsViewControllerDelegate: AnyObject { func versionsControllerWillClose(_ controller: VersionsViewController) } - // MARK: - VersionsViewController // class VersionsViewController: NSViewController { @@ -53,7 +51,6 @@ class VersionsViewController: NSViewController { /// weak var delegate: VersionsViewControllerDelegate? - // MARK: - Lifecycle deinit { @@ -78,7 +75,6 @@ class VersionsViewController: NSViewController { } } - // MARK: - Initialization // private extension VersionsViewController { @@ -98,7 +94,6 @@ private extension VersionsViewController { } } - // MARK: - Notifications // private extension VersionsViewController { @@ -114,7 +109,6 @@ private extension VersionsViewController { } } - // MARK: - NSPopoverDelegate // extension VersionsViewController: NSPopoverDelegate { @@ -129,7 +123,6 @@ extension VersionsViewController: NSPopoverDelegate { } } - // MARK: - Actions // extension VersionsViewController { @@ -145,7 +138,6 @@ extension VersionsViewController { } } - // MARK: - Helpers // private extension VersionsViewController { @@ -179,7 +171,6 @@ private extension VersionsViewController { } } - // MARK: - Simperium // private extension VersionsViewController { @@ -193,7 +184,7 @@ private extension VersionsViewController { } self.versions[note.version] = note - + if String(self.versionSlider.integerValue) == note.version { self.update(withVersion: note.version) } @@ -201,7 +192,6 @@ private extension VersionsViewController { } } - // MARK: - Settings // private enum Settings { diff --git a/Simplenote/Window.swift b/Simplenote/Window.swift index 269e1ecc3..71cb5cb22 100644 --- a/Simplenote/Window.swift +++ b/Simplenote/Window.swift @@ -1,7 +1,6 @@ import Foundation import AppKit - // MARK: - ParentWindowDelegate Protocol // protocol ParentWindowDelegate { @@ -12,7 +11,6 @@ protocol ParentWindowDelegate { func processParentWindowEvent(_ event: NSEvent) -> Bool } - // MARK: - Simplenote Window // class Window: NSWindow { @@ -31,7 +29,6 @@ class Window: NSWindow { /// var semaphoreButtonPaddingX: CGFloat? - // MARK: - Lifecycle deinit { @@ -82,7 +79,6 @@ class Window: NSWindow { } } - // MARK: - Initialization // private extension Window { @@ -96,7 +92,6 @@ private extension Window { } } - // MARK: - Notification Handlers // private extension Window { @@ -112,7 +107,6 @@ private extension Window { } } - // MARK: - Sempahore // private extension Window { @@ -165,7 +159,6 @@ private extension Window { } } - // MARK: - Titlebar / DoubleClick Workaround // private extension Window { diff --git a/SimplenoteTests/EmailVerificationTests.swift b/SimplenoteTests/EmailVerificationTests.swift index 1dcb9dcab..2b992dfae 100644 --- a/SimplenoteTests/EmailVerificationTests.swift +++ b/SimplenoteTests/EmailVerificationTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - EmailVerificationTests // class EmailVerificationTests: XCTestCase { @@ -30,7 +29,7 @@ class EmailVerificationTests: XCTestCase { } func testEmailVerificationIgnoresBrokenPayload() { - let payload : [AnyHashable: Any] = [ + let payload: [AnyHashable: Any] = [ "token": #"{"user": "1234"}"#, "sent_to": 1234 ] diff --git a/SimplenoteTests/MockAccountVerificationRemote.swift b/SimplenoteTests/MockAccountVerificationRemote.swift index 9055df356..d499e11ee 100644 --- a/SimplenoteTests/MockAccountVerificationRemote.swift +++ b/SimplenoteTests/MockAccountVerificationRemote.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - MockAccountVerificationRemote // class MockAccountRemote: AccountRemote { diff --git a/SimplenoteTests/MockStorage+Sample.swift b/SimplenoteTests/MockStorage+Sample.swift index 2546e4cf2..e5beb84a6 100644 --- a/SimplenoteTests/MockStorage+Sample.swift +++ b/SimplenoteTests/MockStorage+Sample.swift @@ -1,7 +1,6 @@ import Foundation @testable import Simplenote - // MARK: - MockStorage Sample Entity Insertion Methods // extension MockStorage { diff --git a/SimplenoteTests/MockStorage.swift b/SimplenoteTests/MockStorage.swift index ae663cd15..eb7161a76 100644 --- a/SimplenoteTests/MockStorage.swift +++ b/SimplenoteTests/MockStorage.swift @@ -2,7 +2,6 @@ import Foundation import CoreData @testable import Simplenote - /// MockupStorage: InMemory CoreData Stack. /// class MockStorage { @@ -41,7 +40,6 @@ class MockStorage { } } - // MARK: - Descriptors // extension MockStorage { @@ -65,7 +63,6 @@ extension MockStorage { } } - // MARK: - Stack URL's // extension MockStorage { @@ -82,7 +79,6 @@ extension MockStorage { } } - // MARK: - Private API(s) // private extension MockStorage { diff --git a/SimplenoteTests/MockTextView.swift b/SimplenoteTests/MockTextView.swift index ae3ce5fe0..37e0b4898 100644 --- a/SimplenoteTests/MockTextView.swift +++ b/SimplenoteTests/MockTextView.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - MockupTextView: Useful for Unit Testing purposes. // NSTextView(s) not properly attached to a window lack UndoManager // @@ -13,7 +12,6 @@ class MockTextView: NSTextView { } } - // MARK: - MockupTextViewDelegate: Useful for Unit Testing Purposes // class MockupTextViewDelegate: NSObject, NSTextViewDelegate { diff --git a/SimplenoteTests/MockURLSession.swift b/SimplenoteTests/MockURLSession.swift index e832a4d94..704e0875c 100644 --- a/SimplenoteTests/MockURLSession.swift +++ b/SimplenoteTests/MockURLSession.swift @@ -2,8 +2,7 @@ import Foundation // MARK: - MockURLSession // -class MockURLSession: URLSession -{ +class MockURLSession: URLSession { var data: (Data?, URLResponse?, Error?)? var lastRequest: URLRequest? diff --git a/SimplenoteTests/MockURLSessionDataTask.swift b/SimplenoteTests/MockURLSessionDataTask.swift index b53d82860..32a97ea9a 100644 --- a/SimplenoteTests/MockURLSessionDataTask.swift +++ b/SimplenoteTests/MockURLSessionDataTask.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - MockURLSessionDataTask // class MockURLSessionDataTask: URLSessionDataTask { diff --git a/SimplenoteTests/NSAttributedStringSimplenoteTests.swift b/SimplenoteTests/NSAttributedStringSimplenoteTests.swift index 056485574..1ccccfb58 100644 --- a/SimplenoteTests/NSAttributedStringSimplenoteTests.swift +++ b/SimplenoteTests/NSAttributedStringSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSAttributedString Unit Tests // class NSAttributedStringSimplenoteTests: XCTestCase { diff --git a/SimplenoteTests/NSAttributedStringToMarkdownConverterTests.swift b/SimplenoteTests/NSAttributedStringToMarkdownConverterTests.swift index 2ede97a2d..ea407568f 100644 --- a/SimplenoteTests/NSAttributedStringToMarkdownConverterTests.swift +++ b/SimplenoteTests/NSAttributedStringToMarkdownConverterTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSAttributedStringToMarkdownConverter Unit Tests // class NSAttributedStringToMarkdownConverterTests: XCTestCase { @@ -25,7 +24,6 @@ class NSAttributedStringToMarkdownConverterTests: XCTestCase { } } - // MARK: - Private Methods // private extension NSAttributedStringToMarkdownConverterTests { diff --git a/SimplenoteTests/NSRegularExpressionSimplenoteTests.swift b/SimplenoteTests/NSRegularExpressionSimplenoteTests.swift index 6381ecf64..30d89dcca 100644 --- a/SimplenoteTests/NSRegularExpressionSimplenoteTests.swift +++ b/SimplenoteTests/NSRegularExpressionSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSRegularExpression Simplenote Unit Tests // class NSRegularExpressionSimplenoteTests: XCTestCase { @@ -113,7 +112,6 @@ class NSRegularExpressionSimplenoteTests: XCTestCase { XCTAssertEqual(matches.count, 1) } - /// Verifies that `NSRegularExpression.regexForListMarkersEmbeddedAnywhere` will match checklists with no spaces between brackets /// func testRegexForListMarkersEmbeddedEverywhereWillMatchChecklistsWithNoInternalSpaces() { diff --git a/SimplenoteTests/NSStringSimplenoteTests.swift b/SimplenoteTests/NSStringSimplenoteTests.swift index 9c79e2da8..d599ef739 100644 --- a/SimplenoteTests/NSStringSimplenoteTests.swift +++ b/SimplenoteTests/NSStringSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSAttributedStringToMarkdownConverter Unit Tests // class NSStringSimplenoteTests: XCTestCase { @@ -176,11 +175,11 @@ class NSStringSimplenoteTests: XCTestCase { let markers = ["•", "-", "+", "*"] for marker in markers { let samples = [ - (text: marker + " Some sample string", location: 0), - (text: "\t" + marker + " Some sample string", location: 1), - (text: " " + marker + " Some sample string", location: 2), - (text: " " + marker + " Some sample string", location: 5), - (text: " " + marker + " Some sample string", location: 5), + (text: marker + " Some sample string", location: 0), + (text: "\t" + marker + " Some sample string", location: 1), + (text: " " + marker + " Some sample string", location: 2), + (text: " " + marker + " Some sample string", location: 5), + (text: " " + marker + " Some sample string", location: 5), ] for (text, location) in samples { diff --git a/SimplenoteTests/NSTextViewSimplenoteTests.swift b/SimplenoteTests/NSTextViewSimplenoteTests.swift index 8238020ac..d57f17abc 100644 --- a/SimplenoteTests/NSTextViewSimplenoteTests.swift +++ b/SimplenoteTests/NSTextViewSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSAttributedStringToMarkdownConverter Unit Tests // class NSTextViewSimplenoteTests: XCTestCase { @@ -14,7 +13,6 @@ class NSTextViewSimplenoteTests: XCTestCase { /// private let delegate = MockupTextViewDelegate() - // MARK: - Overridden Methods override func setUp() { @@ -35,7 +33,6 @@ class NSTextViewSimplenoteTests: XCTestCase { XCTAssertEqual(result.string, text) } - /// Verifies that `selectedLineDroppingTrailingNewline` returns the expected line Range / String, excluding trailing newlines /// func testSelectedLineDroppingTrailingNewlineEffectivelyReturnsTheLineAtTheSelectedRange() { @@ -565,7 +562,6 @@ class NSTextViewSimplenoteTests: XCTestCase { } } - // MARK: - Helpers! // private extension NSTextViewSimplenoteTests { @@ -573,32 +569,32 @@ private extension NSTextViewSimplenoteTests { var samplesForIndentation: [(text: String, indented: String)] { let marker = String.attachmentString return [ - (text: "- L1", indented: "\t- L1"), - (text: "\t- L2", indented: "\t\t- L2"), - (text: " - L3", indented: "\t - L3"), - (text: "* L1", indented: "\t* L1"), - (text: "\t* L2", indented: "\t\t* L2"), - (text: " * L3", indented: "\t * L3"), - (text: "+ L1", indented: "\t+ L1"), - (text: "\t+ L2", indented: "\t\t+ L2"), - (text: " + L3", indented: "\t + L3"), - (text: marker + " L1", indented: "\t" + marker + " L1"), + (text: "- L1", indented: "\t- L1"), + (text: "\t- L2", indented: "\t\t- L2"), + (text: " - L3", indented: "\t - L3"), + (text: "* L1", indented: "\t* L1"), + (text: "\t* L2", indented: "\t\t* L2"), + (text: " * L3", indented: "\t * L3"), + (text: "+ L1", indented: "\t+ L1"), + (text: "\t+ L2", indented: "\t\t+ L2"), + (text: " + L3", indented: "\t + L3"), + (text: marker + " L1", indented: "\t" + marker + " L1"), ] } var samplesForNewline: [(text: String, enhanced: String)] { let marker = String.attachmentString return [ - (text: "- L1", enhanced: "- L1\n- "), - (text: "\t- L2", enhanced: "\t- L2\n\t- "), - (text: " - L3", enhanced: " - L3\n - "), - (text: "* L1", enhanced: "* L1\n* "), - (text: "\t* L2", enhanced: "\t* L2\n\t* "), - (text: " * L3", enhanced: " * L3\n * "), - (text: "+ L1", enhanced: "+ L1\n+ "), - (text: "\t+ L2", enhanced: "\t+ L2\n\t+ "), - (text: " + L3", enhanced: " + L3\n + "), - (text: marker + " L1", enhanced: marker + " L1\n" + marker + String.space), + (text: "- L1", enhanced: "- L1\n- "), + (text: "\t- L2", enhanced: "\t- L2\n\t- "), + (text: " - L3", enhanced: " - L3\n - "), + (text: "* L1", enhanced: "* L1\n* "), + (text: "\t* L2", enhanced: "\t* L2\n\t* "), + (text: " * L3", enhanced: " * L3\n * "), + (text: "+ L1", enhanced: "+ L1\n+ "), + (text: "\t+ L2", enhanced: "\t+ L2\n\t+ "), + (text: " + L3", enhanced: " + L3\n + "), + (text: marker + " L1", enhanced: marker + " L1\n" + marker + String.space), ] } diff --git a/SimplenoteTests/NSUserDefaults+Tests.swift b/SimplenoteTests/NSUserDefaults+Tests.swift index 877844c97..488587354 100644 --- a/SimplenoteTests/NSUserDefaults+Tests.swift +++ b/SimplenoteTests/NSUserDefaults+Tests.swift @@ -1,6 +1,5 @@ import Foundation - // MARK: - UserDefaults Extension Methods // extension UserDefaults { diff --git a/SimplenoteTests/NoteBodyExcerptTests.swift b/SimplenoteTests/NoteBodyExcerptTests.swift index 5f9533d1f..b16c6688d 100644 --- a/SimplenoteTests/NoteBodyExcerptTests.swift +++ b/SimplenoteTests/NoteBodyExcerptTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - String Truncation Tests // class NoteBodyExcerptTests: XCTestCase { diff --git a/SimplenoteTests/NoteListControllerTests.swift b/SimplenoteTests/NoteListControllerTests.swift index 7f29d103b..3f83ba199 100644 --- a/SimplenoteTests/NoteListControllerTests.swift +++ b/SimplenoteTests/NoteListControllerTests.swift @@ -3,7 +3,6 @@ import SimplenoteFoundation import SimplenoteSearch @testable import Simplenote - // MARK: - NoteListControllerTests // class NoteListControllerTests: XCTestCase { @@ -13,7 +12,6 @@ class NoteListControllerTests: XCTestCase { private let storage = MockStorage() private var noteListController: NoteListController! - // MARK: - Overridden Methods override func setUp() { @@ -23,7 +21,6 @@ class NoteListControllerTests: XCTestCase { } } - // MARK: - Tests: Filters // extension NoteListControllerTests { @@ -38,7 +35,7 @@ extension NoteListControllerTests { note.deleted = true storage.save() - XCTAssertEqual(noteListController.numberOfNotes,.zero) + XCTAssertEqual(noteListController.numberOfNotes, .zero) noteListController.filter = .deleted XCTAssertEqual(noteListController.numberOfNotes, .zero) @@ -78,7 +75,6 @@ extension NoteListControllerTests { } } - // MARK: - Tests: Sorting // extension NoteListControllerTests { @@ -102,7 +98,6 @@ extension NoteListControllerTests { } } - // MARK: - Tests: Search // extension NoteListControllerTests { @@ -135,7 +130,6 @@ extension NoteListControllerTests { } } - // MARK: - Tests: `note(at:)` // extension NoteListControllerTests { @@ -185,7 +179,6 @@ extension NoteListControllerTests { } } - // MARK: - Tests: `indexOfNote(withSimperiumKey:)` // extension NoteListControllerTests { @@ -218,7 +211,6 @@ extension NoteListControllerTests { } } - // MARK: - Tests: onDidChangeContent // extension NoteListControllerTests { @@ -371,7 +363,6 @@ extension NoteListControllerTests { } } - // MARK: - Private APIs // private extension NoteListControllerTests { diff --git a/SimplenoteTests/OptionsTests.swift b/SimplenoteTests/OptionsTests.swift index 3e7c472d5..4ed64aaad 100644 --- a/SimplenoteTests/OptionsTests.swift +++ b/SimplenoteTests/OptionsTests.swift @@ -2,7 +2,6 @@ import Foundation import XCTest @testable import Simplenote - // MARK: - Options Unit Tests // class OptionsTests: XCTestCase { diff --git a/SimplenoteTests/StringContentSliceTests.swift b/SimplenoteTests/StringContentSliceTests.swift index a9acdba7c..b90a7e807 100644 --- a/SimplenoteTests/StringContentSliceTests.swift +++ b/SimplenoteTests/StringContentSliceTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - String Content Slice Tests // class StringContentSliceTests: XCTestCase { diff --git a/SimplenoteTests/StringSimplenoteTests.swift b/SimplenoteTests/StringSimplenoteTests.swift index b149faa93..2cb60fbf7 100644 --- a/SimplenoteTests/StringSimplenoteTests.swift +++ b/SimplenoteTests/StringSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - NSString Simplenote Tests // class StringSimplenoteTests: XCTestCase { diff --git a/SimplenoteTests/TextViewInputHandlerTests.swift b/SimplenoteTests/TextViewInputHandlerTests.swift index 55b983b85..e7fe70427 100644 --- a/SimplenoteTests/TextViewInputHandlerTests.swift +++ b/SimplenoteTests/TextViewInputHandlerTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - TextViewInputHandler Tests // class TextViewInputHandlerTests: XCTestCase { @@ -18,7 +17,6 @@ class TextViewInputHandlerTests: XCTestCase { /// let delegate = MockupTextViewDelegate() - // MARK: - Overridden override func setUp() { diff --git a/SimplenoteTests/UnicodeScalarSimplenoteTests.swift b/SimplenoteTests/UnicodeScalarSimplenoteTests.swift index 8f1ce919c..7adfcf22b 100644 --- a/SimplenoteTests/UnicodeScalarSimplenoteTests.swift +++ b/SimplenoteTests/UnicodeScalarSimplenoteTests.swift @@ -1,7 +1,6 @@ import XCTest @testable import Simplenote - // MARK: - UnicodeScalarSimplenoteTests Unit Tests // class UnicodeScalarSimplenoteTests: XCTestCase { From a0b9ea721d8ce24f88f6cfccf0cfe6d536d6b3bc Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 26 Feb 2024 20:04:52 +0100 Subject: [PATCH 6/6] Update README file --- readme.md | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/readme.md b/readme.md index ad378fc06..5067be2fe 100644 --- a/readme.md +++ b/readme.md @@ -33,25 +33,8 @@ Hopefully, you won't need to update Sparkle till version 2.x has shipped but, in #### SwiftLint -We use [SwiftLint](https://github.com/realm/SwiftLint) to enforce a common style for Swift code. The app should build and work without it, but if you plan to write code, you are encouraged to install it. No commit should have lint warnings or errors. - -You can set up a Git [pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to run SwiftLint automatically when committing by running: - -`rake git:install_hooks` - -This is the recommended way to include SwiftLint in your workflow, as it catches lint issues locally before your code makes its way to Github. - -Alternately, a SwiftLint scheme is exposed within the project; Xcode will show a warning if you don't have SwiftLint installed. - -Finally, you can also run SwiftLint manually from the command line with: - -`rake lint` - -If your code has any style violations, you can try to automatically correct them by running: - -`rake lint:autocorrect` - -Otherwise you have to fix them manually. +We use [SwiftLint](https://github.com/realm/SwiftLint) to enforce a common style for Swift code. If you plan to write code, SwiftLint is going to be installed when you run `bundle exec pod install` and SwiftLint will run during the build. +No commit should have lint warnings or errors. ### Open Xcode