Skip to content

Commit

Permalink
Run SwiftLint autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Caselani committed Apr 4, 2020
1 parent b50e8db commit 4d79142
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 69 deletions.
18 changes: 9 additions & 9 deletions CouchTrackerApp/Persistence/Realm/RealmAdapters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
60 changes: 30 additions & 30 deletions CouchTrackerCore/Entities/Builders/WatchedShowBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions CouchTrackerCore/EntityMappers/MovieEntityMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions CouchTrackerCore/EntityMappers/ShowEntityMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion CouchTrackerCore/Shows/Progress/ShowProgressFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
24 changes: 12 additions & 12 deletions CouchTrackerCore/Shows/Progress/ShowProgressSort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit 4d79142

Please sign in to comment.