From cbcf58d5c765316e7da20a9acf047218860508d5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 19 Jun 2021 22:17:48 +0200 Subject: [PATCH] Fix codestyle --- .swiftformat | 2 ++ .swiftlint.yml | 8 ++++++++ Apple TV/TrendingCountrySelectionView.swift | 2 +- Apple TV/TrendingView.swift | 3 +-- Model/PlayerState.swift | 2 +- Model/SponsorBlockSegmentsProvider.swift | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .swiftformat diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 00000000..229d4488 --- /dev/null +++ b/.swiftformat @@ -0,0 +1,2 @@ +--disable trailingCommas +--exclude Tests* diff --git a/.swiftlint.yml b/.swiftlint.yml index 97a9003b..ffa86914 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1 +1,9 @@ parent_config: https://raw.githubusercontent.com/sindresorhus/swiftlint-config/main/.swiftlint.yml + +disabled_rules: + - opening_brace + +excluded: + - Tests Apple TV + - Tests iOS + - Tests macOS diff --git a/Apple TV/TrendingCountrySelectionView.swift b/Apple TV/TrendingCountrySelectionView.swift index 1857f3ab..f54cace4 100644 --- a/Apple TV/TrendingCountrySelectionView.swift +++ b/Apple TV/TrendingCountrySelectionView.swift @@ -2,7 +2,7 @@ import SwiftUI struct TrendingCountrySelectionView: View { @Environment(\.presentationMode) private var presentationMode - @ObservedObject var provider: TrendingCountriesProvider + @ObservedObject private var provider = TrendingCountriesProvider() @State private var query: String = "" @Binding var selectedCountry: Country diff --git a/Apple TV/TrendingView.swift b/Apple TV/TrendingView.swift index cd5c7b97..0df9c0cb 100644 --- a/Apple TV/TrendingView.swift +++ b/Apple TV/TrendingView.swift @@ -6,7 +6,6 @@ struct TrendingView: View { @Binding var tabSelection: TabSelection - @ObservedObject private var countriesProvider = TrendingCountriesProvider() @ObservedObject private var videosProvider = TrendingVideosProvider() @State private var selectingCategory = false @@ -32,7 +31,7 @@ struct TrendingView: View { selectingCountry.toggle() } .fullScreenCover(isPresented: $selectingCountry) { - TrendingCountrySelectionView(provider: countriesProvider, selectedCountry: $trendingState.country) + TrendingCountrySelectionView(selectedCountry: $trendingState.country) } Spacer() diff --git a/Model/PlayerState.swift b/Model/PlayerState.swift index 42d04bb1..13909ba8 100644 --- a/Model/PlayerState.swift +++ b/Model/PlayerState.swift @@ -33,7 +33,7 @@ final class PlayerState: ObservableObject { var externalMetadata = [ makeMetadataItem(.commonIdentifierTitle, value: video.title), makeMetadataItem(.quickTimeMetadataGenre, value: video.genre), - makeMetadataItem(.commonIdentifierDescription, value: video.description), + makeMetadataItem(.commonIdentifierDescription, value: video.description) ] if let thumbnailData = try? Data(contentsOf: video.thumbnailURL!), diff --git a/Model/SponsorBlockSegmentsProvider.swift b/Model/SponsorBlockSegmentsProvider.swift index 312d7abf..ad36db3a 100644 --- a/Model/SponsorBlockSegmentsProvider.swift +++ b/Model/SponsorBlockSegmentsProvider.swift @@ -29,7 +29,7 @@ final class SponsorBlockSegmentsProvider: ObservableObject { private var parameters: [String: String] { [ "videoID": id, - "categories": JSON(SponsorBlockSegmentsProvider.categories).rawString(String.Encoding.utf8)!, + "categories": JSON(SponsorBlockSegmentsProvider.categories).rawString(String.Encoding.utf8)! ] } }