From 4d79142b1d855912212bc6ab0dbb30031330b79c Mon Sep 17 00:00:00 2001 From: Pietro Caselani Date: Sat, 4 Apr 2020 18:01:41 +0200 Subject: [PATCH] Run SwiftLint autocorrect --- .../Persistence/Realm/RealmAdapters.swift | 18 +++--- .../Builders/WatchedSeasonEntityBuilder.swift | 18 +++--- .../Builders/WatchedShowBuilder.swift | 60 +++++++++---------- .../EntityMappers/MovieEntityMapper.swift | 12 ++-- .../EntityMappers/ShowEntityMapper.swift | 4 +- .../Shows/Progress/ShowProgressFilter.swift | 2 +- .../Shows/Progress/ShowProgressSort.swift | 24 ++++---- 7 files changed, 69 insertions(+), 69 deletions(-) diff --git a/CouchTrackerApp/Persistence/Realm/RealmAdapters.swift b/CouchTrackerApp/Persistence/Realm/RealmAdapters.swift index 4fb9e84d..53143de1 100644 --- a/CouchTrackerApp/Persistence/Realm/RealmAdapters.swift +++ b/CouchTrackerApp/Persistence/Realm/RealmAdapters.swift @@ -22,11 +22,11 @@ extension Genre { extension ShowIdsRealm { func toEntity() -> ShowIds { ShowIds(trakt: trakt, - tmdb: tmdb.value, - imdb: imdb, - slug: slug, - tvdb: tvdb, - tvrage: tvrage.value) + tmdb: tmdb.value, + imdb: imdb, + slug: slug, + tvdb: tvdb, + tvrage: tvrage.value) } } @@ -88,10 +88,10 @@ extension WatchedEpisodeEntity { extension EpisodeIdsRealm { public func toEntity() -> EpisodeIds { EpisodeIds(trakt: trakt, - tmdb: tmdb.value, - imdb: imdb, - tvdb: tvdb.value, - tvrage: tvrage.value) + tmdb: tmdb.value, + imdb: imdb, + tvdb: tvdb.value, + tvrage: tvrage.value) } } diff --git a/CouchTrackerCore/Entities/Builders/WatchedSeasonEntityBuilder.swift b/CouchTrackerCore/Entities/Builders/WatchedSeasonEntityBuilder.swift index be2cbe10..e03a5af9 100644 --- a/CouchTrackerCore/Entities/Builders/WatchedSeasonEntityBuilder.swift +++ b/CouchTrackerCore/Entities/Builders/WatchedSeasonEntityBuilder.swift @@ -16,23 +16,23 @@ public struct WatchedSeasonEntityBuilder: Hashable { public func set(progressSeason: BaseSeason?) -> WatchedSeasonEntityBuilder { WatchedSeasonEntityBuilder(showIds: showIds, - progressSeason: progressSeason, - detailSeason: detailSeason, - episodes: episodes) + progressSeason: progressSeason, + detailSeason: detailSeason, + episodes: episodes) } public func set(episodes: [WatchedEpisodeEntityBuilder]?) -> WatchedSeasonEntityBuilder { WatchedSeasonEntityBuilder(showIds: showIds, - progressSeason: progressSeason, - detailSeason: detailSeason, - episodes: episodes) + progressSeason: progressSeason, + detailSeason: detailSeason, + episodes: episodes) } public func set(detailSeason: Season?) -> WatchedSeasonEntityBuilder { WatchedSeasonEntityBuilder(showIds: showIds, - progressSeason: progressSeason, - detailSeason: detailSeason, - episodes: episodes) + progressSeason: progressSeason, + detailSeason: detailSeason, + episodes: episodes) } public func createEntity() -> WatchedSeasonEntity { diff --git a/CouchTrackerCore/Entities/Builders/WatchedShowBuilder.swift b/CouchTrackerCore/Entities/Builders/WatchedShowBuilder.swift index b39fd521..285e5789 100644 --- a/CouchTrackerCore/Entities/Builders/WatchedShowBuilder.swift +++ b/CouchTrackerCore/Entities/Builders/WatchedShowBuilder.swift @@ -22,60 +22,60 @@ public final class WatchedShowBuilder: Hashable { @discardableResult public func set(episode: WatchedEpisodeEntity?) -> WatchedShowBuilder { WatchedShowBuilder(ids: ids, - detailShow: detailShow, - progressShow: progressShow, - episode: episode, - seasons: seasons, - genres: genres) + detailShow: detailShow, + progressShow: progressShow, + episode: episode, + seasons: seasons, + genres: genres) } @discardableResult public func set(progressShow: BaseShow?) -> WatchedShowBuilder { WatchedShowBuilder(ids: ids, - detailShow: detailShow, - progressShow: progressShow, - episode: episode, - seasons: seasons, - genres: genres) + detailShow: detailShow, + progressShow: progressShow, + episode: episode, + seasons: seasons, + genres: genres) } @discardableResult public func set(detailShow: BaseShow?) -> WatchedShowBuilder { WatchedShowBuilder(ids: ids, - detailShow: detailShow, - progressShow: progressShow, - episode: episode, - seasons: seasons, - genres: genres) + detailShow: detailShow, + progressShow: progressShow, + episode: episode, + seasons: seasons, + genres: genres) } @discardableResult public func set(seasons: [WatchedSeasonEntity]) -> WatchedShowBuilder { WatchedShowBuilder(ids: ids, - detailShow: detailShow, - progressShow: progressShow, - episode: episode, - seasons: seasons, - genres: genres) + detailShow: detailShow, + progressShow: progressShow, + episode: episode, + seasons: seasons, + genres: genres) } @discardableResult public func set(genres: [Genre]) -> WatchedShowBuilder { WatchedShowBuilder(ids: ids, - detailShow: detailShow, - progressShow: progressShow, - episode: episode, - seasons: seasons, - genres: genres) + detailShow: detailShow, + progressShow: progressShow, + episode: episode, + seasons: seasons, + genres: genres) } public func createEntity(using showEntity: ShowEntity) -> WatchedShowEntity { WatchedShowEntity(show: showEntity, - aired: progressShow?.aired, - completed: progressShow?.completed, - nextEpisode: episode, - lastWatched: progressShow?.lastWatchedAt, - seasons: seasons) + aired: progressShow?.aired, + completed: progressShow?.completed, + nextEpisode: episode, + lastWatched: progressShow?.lastWatchedAt, + seasons: seasons) } public func createEntity() -> WatchedShowEntity { diff --git a/CouchTrackerCore/EntityMappers/MovieEntityMapper.swift b/CouchTrackerCore/EntityMappers/MovieEntityMapper.swift index a6f69349..96c362e9 100644 --- a/CouchTrackerCore/EntityMappers/MovieEntityMapper.swift +++ b/CouchTrackerCore/EntityMappers/MovieEntityMapper.swift @@ -6,12 +6,12 @@ public final class MovieEntityMapper { public static func entity(for movie: Movie, with genres: [Genre], watchedAt: Date? = nil) -> MovieEntity { MovieEntity(ids: movie.ids, - title: movie.title, - genres: genres, - tagline: movie.tagline, - overview: movie.overview, - releaseDate: movie.released, - watchedAt: watchedAt) + title: movie.title, + genres: genres, + tagline: movie.tagline, + overview: movie.overview, + releaseDate: movie.released, + watchedAt: watchedAt) } public static func entity(for trendingMovie: TrendingMovie, with genres: [Genre]) -> TrendingMovieEntity { diff --git a/CouchTrackerCore/EntityMappers/ShowEntityMapper.swift b/CouchTrackerCore/EntityMappers/ShowEntityMapper.swift index 4c0f7f14..9549b0ec 100644 --- a/CouchTrackerCore/EntityMappers/ShowEntityMapper.swift +++ b/CouchTrackerCore/EntityMappers/ShowEntityMapper.swift @@ -3,8 +3,8 @@ import TraktSwift public enum ShowEntityMapper { public static func entity(for show: Show, with genres: [Genre] = [Genre]()) -> ShowEntity { ShowEntity(ids: show.ids, title: show.title, - overview: show.overview, network: show.network, - genres: genres, status: show.status, firstAired: show.firstAired) + overview: show.overview, network: show.network, + genres: genres, status: show.status, firstAired: show.firstAired) } public static func entity(for trendingShow: TrendingShow, with genres: [Genre]) -> TrendingShowEntity { diff --git a/CouchTrackerCore/Shows/Progress/ShowProgressFilter.swift b/CouchTrackerCore/Shows/Progress/ShowProgressFilter.swift index ba5ffe73..85689820 100644 --- a/CouchTrackerCore/Shows/Progress/ShowProgressFilter.swift +++ b/CouchTrackerCore/Shows/Progress/ShowProgressFilter.swift @@ -45,7 +45,7 @@ public enum ShowProgressFilter: String { } private func filterReturningWatched() -> (WatchedShowEntity) -> Bool { { (entity: WatchedShowEntity) in - (entity.aired ?? -1) - (entity.completed ?? -1) > 0 || entity.show.status == Status.returning + (entity.aired ?? -1) - (entity.completed ?? -1) > 0 || entity.show.status == Status.returning } } } diff --git a/CouchTrackerCore/Shows/Progress/ShowProgressSort.swift b/CouchTrackerCore/Shows/Progress/ShowProgressSort.swift index 10a3b62c..a7346b7a 100644 --- a/CouchTrackerCore/Shows/Progress/ShowProgressSort.swift +++ b/CouchTrackerCore/Shows/Progress/ShowProgressSort.swift @@ -50,30 +50,30 @@ public enum ShowProgressSort: String { } private func titleComparator() -> (WatchedShowEntity, WatchedShowEntity) -> Bool { { (lhs: WatchedShowEntity, rhs: WatchedShowEntity) in - let rhsTitle = rhs.show.title ?? "" - let lhsTitle = lhs.show.title ?? "" - return lhsTitle < rhsTitle + let rhsTitle = rhs.show.title ?? "" + let lhsTitle = lhs.show.title ?? "" + return lhsTitle < rhsTitle } } private func remainingComparator() -> (WatchedShowEntity, WatchedShowEntity) -> Bool { { (lhs: WatchedShowEntity, rhs: WatchedShowEntity) in - let lhsRemaining = (lhs.aired ?? 0) - (lhs.completed ?? 0) - let rhsRemaining = (rhs.aired ?? 0) - (rhs.completed ?? 0) - return lhsRemaining < rhsRemaining + let lhsRemaining = (lhs.aired ?? 0) - (lhs.completed ?? 0) + let rhsRemaining = (rhs.aired ?? 0) - (rhs.completed ?? 0) + return lhsRemaining < rhsRemaining } } private func lastWatchedComparator() -> (WatchedShowEntity, WatchedShowEntity) -> Bool { { (lhs: WatchedShowEntity, rhs: WatchedShowEntity) in - let lhsLastWatched = lhs.lastWatched ?? Date(timeIntervalSince1970: 0) - let rhsLastWatched = rhs.lastWatched ?? Date(timeIntervalSince1970: 0) - return lhsLastWatched > rhsLastWatched + let lhsLastWatched = lhs.lastWatched ?? Date(timeIntervalSince1970: 0) + let rhsLastWatched = rhs.lastWatched ?? Date(timeIntervalSince1970: 0) + return lhsLastWatched > rhsLastWatched } } private func releaseDateComparator() -> (WatchedShowEntity, WatchedShowEntity) -> Bool { { (lhs: WatchedShowEntity, rhs: WatchedShowEntity) in - let lhsFirstAired = lhs.nextEpisode?.episode.firstAired ?? Date(timeIntervalSince1970: 0) - let rhsFirstAired = rhs.nextEpisode?.episode.firstAired ?? Date(timeIntervalSince1970: 0) - return lhsFirstAired > rhsFirstAired + let lhsFirstAired = lhs.nextEpisode?.episode.firstAired ?? Date(timeIntervalSince1970: 0) + let rhsFirstAired = rhs.nextEpisode?.episode.firstAired ?? Date(timeIntervalSince1970: 0) + return lhsFirstAired > rhsFirstAired } } }