Skip to content

Commit

Permalink
Change all classes protocol to use AnyObject
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrocaselani committed May 1, 2019
1 parent db5f29d commit 105760b
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions CouchTrackerCore/AppFlow/AppFlowContract.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import RxSwift

public protocol AppFlowModuleDataSource: class {
public protocol AppFlowModuleDataSource: AnyObject {
var modulePages: [ModulePage] { get }
}

public protocol AppFlowPresenter: class {
public protocol AppFlowPresenter: AnyObject {
init(repository: AppFlowRepository, moduleDataSource: AppFlowModuleDataSource)

func observeViewState() -> Observable<AppFlowViewState>
func viewDidLoad()
func selectTab(index: Int)
}

public protocol AppFlowRepository: class {
public protocol AppFlowRepository: AnyObject {
var lastSelectedTab: Int { get set }
}
6 changes: 3 additions & 3 deletions CouchTrackerCore/AppState/AppStateContract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ public enum AppStateViewState: Hashable {
case showing(configs: [AppStateViewModel])
}

public protocol AppStateDataHolder: class {
public protocol AppStateDataHolder: AnyObject {
func currentAppState() throws -> AppState
func save(appState: AppState) throws
}

public protocol AppStateRouter: class {
public protocol AppStateRouter: AnyObject {
func showTraktLogin()
func finishLogin()
func showExternal(url: URL)
func showError(message: String)
}

public protocol AppStatePresenter: class {
public protocol AppStatePresenter: AnyObject {
func viewDidLoad()
func observeViewState() -> Observable<AppStateViewState>
func select(configuration: AppConfigurationViewModel)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import RxSwift
import TMDBSwift

public protocol ConfigurationRepository: class {
public protocol ConfigurationRepository: AnyObject {
init(tmdbProvider: TMDBProvider)

func fetchConfiguration() -> Observable<Configuration>
Expand Down
2 changes: 1 addition & 1 deletion CouchTrackerCore/Core/BaseView.swift
Original file line number Diff line number Diff line change
@@ -1 +1 @@
public protocol BaseView: class {}
public protocol BaseView: AnyObject {}
2 changes: 1 addition & 1 deletion CouchTrackerCore/Core/Schedulers.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import RxSwift

public protocol Schedulers: class {
public protocol Schedulers: AnyObject {
var networkScheduler: SchedulerType { get }
var networkQueue: DispatchQueue { get }
var dataSourceScheduler: ImmediateSchedulerType { get }
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Images/ImageRepository.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import RxSwift

public protocol MovieImageRepository: class {
public protocol MovieImageRepository: AnyObject {
func fetchMovieImages(for movieId: Int, posterSize: PosterImageSize?,
backdropSize: BackdropImageSize?) -> Maybe<ImagesEntity>
}

public protocol ShowImageRepository: class {
public protocol ShowImageRepository: AnyObject {
func fetchShowImages(for showId: Int, posterSize: PosterImageSize?,
backdropSize: BackdropImageSize?) -> Maybe<ImagesEntity>
}

public protocol EpisodeImageRepository: class {
public protocol EpisodeImageRepository: AnyObject {
func fetchEpisodeImages(for episode: EpisodeImageInput, size: EpisodeImageSizes?) -> Maybe<URL>
}

Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/MovieDetails/MovieDetailsContract.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import RxSwift
import TraktSwift

public protocol MovieDetailsPresenter: class {
public protocol MovieDetailsPresenter: AnyObject {
func viewDidLoad()

func observeViewState() -> Observable<MovieDetailsViewState>
func observeImagesState() -> Observable<MovieDetailsImagesState>
func handleWatched() -> Completable
}

public protocol MovieDetailsInteractor: class {
public protocol MovieDetailsInteractor: AnyObject {
func fetchDetails() -> Observable<MovieEntity>
func fetchImages() -> Maybe<ImagesEntity>
func toggleWatched(movie: MovieEntity) -> Completable
}

public protocol MovieDetailsRepository: class {
public protocol MovieDetailsRepository: AnyObject {
func fetchDetails(movieId: String) -> Observable<Movie>
func watched(movieId: Int) -> Single<WatchedMovieResult>
func addToHistory(movie: MovieEntity) -> Single<SyncMovieResult>
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Movies/Manager/MoviesManagerContract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ public enum MoviesManagerOption: String {
case search
}

public protocol MoviesManagerPresenter: class {
public protocol MoviesManagerPresenter: AnyObject {
init(dataSource: MoviesManagerDataSource)

func observeViewState() -> Observable<MoviesManagerViewState>
func viewDidLoad()
func selectTab(index: Int)
}

public protocol MoviesManagerModuleCreator: class {
public protocol MoviesManagerModuleCreator: AnyObject {
func createModule(for option: MoviesManagerOption) -> BaseView
}

public protocol MoviesManagerDataSource: class {
public protocol MoviesManagerDataSource: AnyObject {
var options: [MoviesManagerOption] { get }
var modulePages: [ModulePage] { get }
var defaultModuleIndex: Int { get set }
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/PosterCell/PosterCellContract.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import RxSwift

public protocol PosterCellView: class {
public protocol PosterCellView: AnyObject {
var presenter: PosterCellPresenter! { get set }

func show(viewModel: PosterCellViewModel)
func showPosterImage(with url: URL)
}

public protocol PosterCellPresenter: class {
public protocol PosterCellPresenter: AnyObject {
init(view: PosterCellView, interactor: PosterCellInteractor, viewModel: PosterViewModel)

func viewWillAppear()
}

public protocol PosterCellInteractor: class {
public protocol PosterCellInteractor: AnyObject {
init(imageRepository: ImageRepository)

func fetchPosterImageURL(of type: PosterViewModelType, with size: PosterImageSize?) -> Maybe<URL>
Expand Down
2 changes: 1 addition & 1 deletion CouchTrackerCore/Providers/TMDBProvider.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Moya
import TMDBSwift

public protocol TMDBProvider: class {
public protocol TMDBProvider: AnyObject {
var movies: MoyaProvider<Movies> { get }
var shows: MoyaProvider<Shows> { get }
var configuration: MoyaProvider<ConfigurationService> { get }
Expand Down
2 changes: 1 addition & 1 deletion CouchTrackerCore/Providers/TVDBProvider.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Moya
import TVDBSwift

public protocol TVDBProvider: class {
public protocol TVDBProvider: AnyObject {
var episodes: MoyaProvider<Episodes> { get }
}
2 changes: 1 addition & 1 deletion CouchTrackerCore/Providers/TraktProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Moya
import RxSwift
import TraktSwift

public protocol TraktProvider: class {
public protocol TraktProvider: AnyObject {
var movies: MoyaProvider<Movies> { get }
var genres: MoyaProvider<Genres> { get }
var search: MoyaProvider<Search> { get }
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Search/SearchContract.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import RxSwift
import TraktSwift

public protocol SearchPresenter: class {
public protocol SearchPresenter: AnyObject {
func search(query: String)
func cancelSearch()
func select(entity: SearchResultEntity)
func observeSearchState() -> Observable<SearchState>
}

public protocol SearchInteractor: class {
public protocol SearchInteractor: AnyObject {
func search(query: String, types: [SearchType], page: Int, limit: Int) -> Single<[SearchResult]>
}

public protocol SearchRouter: class {
public protocol SearchRouter: AnyObject {
func showViewFor(entity: SearchResultEntity)
}
8 changes: 4 additions & 4 deletions CouchTrackerCore/Show/Episode/ShowEpisodeContract.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import RxSwift
import TraktSwift

public protocol ShowEpisodeNetwork: class {
public protocol ShowEpisodeNetwork: AnyObject {
func addToHistory(items: SyncItems) -> Single<SyncResponse>
func removeFromHistory(items: SyncItems) -> Single<SyncResponse>
}

public protocol ShowEpisodeRepository: class {
public protocol ShowEpisodeRepository: AnyObject {
func addToHistory(episode: EpisodeEntity) -> Single<WatchedShowEntity>
func removeFromHistory(episode: EpisodeEntity) -> Single<WatchedShowEntity>
}

public protocol ShowEpisodeInteractor: class {
public protocol ShowEpisodeInteractor: AnyObject {
func fetchImages(for episode: EpisodeImageInput) -> Maybe<ShowEpisodeImages>
func toggleWatch(for episode: WatchedEpisodeEntity) -> Single<WatchedShowEntity>
}

public protocol ShowEpisodePresenter: class {
public protocol ShowEpisodePresenter: AnyObject {
func viewDidLoad()
func observeViewState() -> Observable<ShowEpisodeViewState>
func handleWatch() -> Completable
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Show/Manager/ShowManagerContract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ public enum ShowManagerOption: String {
case seasons
}

public protocol ShowManagerPresenter: class {
public protocol ShowManagerPresenter: AnyObject {
init(dataSource: ShowManagerDataSource)

func observeViewState() -> Observable<ShowManagerViewState>
func viewDidLoad()
func selectTab(index: Int)
}

public protocol ShowManagerModuleCreator: class {
public protocol ShowManagerModuleCreator: AnyObject {
func createModule(for option: ShowManagerOption) -> BaseView
}

public protocol ShowManagerDataSource: class {
public protocol ShowManagerDataSource: AnyObject {
init(show: WatchedShowEntity, creator: ShowManagerModuleCreator)

var showTitle: String? { get }
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Show/Overview/ShowOverviewContract.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import RxSwift
import TraktSwift

public protocol ShowOverviewRepository: class {
public protocol ShowOverviewRepository: AnyObject {
func fetchDetailsOfShow(with identifier: String, extended: Extended) -> Single<Show>
}

public protocol ShowOverviewInteractor: class {
public protocol ShowOverviewInteractor: AnyObject {
init(showIds: ShowIds, repository: ShowOverviewRepository,
genreRepository: GenreRepository, imageRepository: ImageRepository)

func fetchDetailsOfShow() -> Single<ShowEntity>
func fetchImages() -> Maybe<ImagesEntity>
}

public protocol ShowOverviewPresenter: class {
public protocol ShowOverviewPresenter: AnyObject {
init(interactor: ShowOverviewInteractor)

func viewDidLoad()
Expand Down
6 changes: 3 additions & 3 deletions CouchTrackerCore/Shows/Manager/ShowsManagerContract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ public enum ShowsManagerOption: String {
case search
}

public protocol ShowsManagerPresenter: class {
public protocol ShowsManagerPresenter: AnyObject {
init(dataSource: ShowsManagerDataSource)

func observeViewState() -> Observable<ShowsManagerViewState>
func viewDidLoad()
func selectTab(index: Int)
}

public protocol ShowsManagerDataSource: class {
public protocol ShowsManagerDataSource: AnyObject {
init(creator: ShowsManagerModuleCreator)

var options: [ShowsManagerOption] { get }
var modulePages: [ModulePage] { get }
var defaultModuleIndex: Int { get set }
}

public protocol ShowsManagerModuleCreator: class {
public protocol ShowsManagerModuleCreator: AnyObject {
func createModule(for option: ShowsManagerOption) -> BaseView
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ public enum ShowProgressCellViewState: Hashable {
case viewModelAndPosterURL(viewModel: WatchedShowViewModel, url: URL)
}

public protocol ShowProgressCellPresenter: class {
public protocol ShowProgressCellPresenter: AnyObject {
init(interactor: ShowProgressCellInteractor, viewModel: WatchedShowViewModel)

func viewWillAppear()
func observeViewState() -> Observable<ShowProgressCellViewState>
}

public protocol ShowProgressCellInteractor: class {
public protocol ShowProgressCellInteractor: AnyObject {
init(imageRepository: ImageRepository)

func fetchPosterImageURL(for tmdbId: Int, with size: PosterImageSize?) -> Maybe<URL>
Expand Down
10 changes: 5 additions & 5 deletions CouchTrackerCore/Shows/Progress/ShowsProgressContract.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import RxSwift
import TraktSwift

public protocol ShowsProgressDataSource: class {
public protocol ShowsProgressDataSource: AnyObject {
func fetchWatchedShows() -> Observable<[WatchedShowEntity]>
func addWatched(shows: [WatchedShowEntity]) throws
}

public protocol ShowsProgressListStateDataSource: class {
public protocol ShowsProgressListStateDataSource: AnyObject {
var currentState: ShowProgressListState { get set }
}

public protocol ShowsProgressInteractor: class {
public protocol ShowsProgressInteractor: AnyObject {
var listState: Observable<ShowProgressListState> { get }

func fetchWatchedShowsProgress() -> Observable<WatchedShowEntitiesState>
func toggleDirection() -> Completable
func change(sort: ShowProgressSort, filter: ShowProgressFilter) -> Completable
}

public protocol ShowsProgressRouter: class {
public protocol ShowsProgressRouter: AnyObject {
func show(tvShow entity: WatchedShowEntity)
}

public protocol ShowsProgressPresenter: class {
public protocol ShowsProgressPresenter: AnyObject {
func observeViewState() -> Observable<ShowProgressViewState>

func change(sort: ShowProgressSort, filter: ShowProgressFilter) -> Completable
Expand Down
8 changes: 4 additions & 4 deletions CouchTrackerCore/TraktLogin/TraktLoginContract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import Foundation
import RxSwift
import TraktSwift

public protocol TraktLoginInteractor: class {
public protocol TraktLoginInteractor: AnyObject {
func fetchLoginURL() -> Single<URL>
func allowedToProcess(request: URLRequest) -> Completable
}

public protocol TraktLoginPresenter: class {
public protocol TraktLoginPresenter: AnyObject {
init(view: TraktLoginView, interactor: TraktLoginInteractor, schedulers: Schedulers)

func viewDidLoad()
func allowedToProcess(request: URLRequest) -> Completable
}

public protocol TraktLoginView: class {
public protocol TraktLoginView: AnyObject {
var presenter: TraktLoginPresenter! { get set }

func loadLogin(using url: URL)
func showError(error: Error)
}

public protocol TraktLoginPolicyDecider: class {
public protocol TraktLoginPolicyDecider: AnyObject {
func allowedToProceed(with request: URLRequest) -> Single<AuthenticationResult>
}
Loading

0 comments on commit 105760b

Please sign in to comment.