This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileprivate func createOnGoingMovieSection() -> NSCollectionLayoutSection { | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(2/3)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(1.0)) | |
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 3) | |
group.contentInsets = .init(top: 5, leading: 0, bottom: 5, trailing: 20) | |
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), | |
heightDimension: .estimated(44)) | |
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: MovieViewController.sectionHeaderElementKind, alignment: .top) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol ListMovieDisplayLogic: AnyObject { | |
func displayMovies(movie: [Movie]) | |
func displayErrorMessage(error: ErrorResponse) | |
} | |
class ListMovieViewController: UITableViewController { | |
private var movies: [Movie] = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ListMovieDataLogic { | |
func fetchMovies() | |
} | |
protocol ListMovieDataStore { | |
var movies: [Movie]? { get } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ListMoviePresentationLogic { | |
func displayMovies(movies: [Movie]) | |
func displayErrorMessage(error: ErrorResponse) | |
} | |
class ListMoviePresenter: ListMoviePresentationLogic { | |
weak var viewController: ListMovieDisplayLogic? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol MovieStoreProtocol { | |
func fetchMovies(success: @escaping (_ movie: MoviesResponse)-> Void, failure: @escaping (_ error: ErrorResponse)-> Void) | |
} | |
class MovieService { | |
var movieStore: MovieStoreProtocol | |
init(movieStore: MovieStoreProtocol) { | |
self.movieStore = movieStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@testable import MovieVIP | |
import XCTest | |
class ListMovieViewControllerTest: XCTestCase { | |
// MARK:- Subject Under Test | |
var sut: ListMovieViewController! | |
var window: UIWindow! | |
// MARK:- Test lifecycle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@testable import iRestaurant | |
import CoreData | |
class TestCoreDataStack: CoreDataStack { | |
override init() { | |
super.init() | |
//1 | |
let persistentStoreDescription = NSPersistentStoreDescription() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class iRestaurantTests: XCTestCase { | |
//1 | |
var sut: RestoDataStore! | |
var coreDataStack: TestCoreDataStack! | |
//2 | |
override func setUpWithError() throws { | |
coreDataStack = TestCoreDataStack() | |
sut = RestoDataStore( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testBackgroundContextToSaveMenu() { | |
//1 | |
let backgroundContext = coreDataStack.backgroundContext() | |
sut = RestoDataStore( | |
context: backgroundContext, | |
coreDataStack: coreDataStack | |
) | |
expectation(forNotification: .NSManagedObjectContextDidSave, object: backgroundContext) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Toast | |
protocol HeroListViewPresentationProtocol: class { | |
func showHero() | |
func reloadData() | |
func showError() | |
func showInternetConnectionProblemMessage() | |
} |