Skip to content

Instantly share code, notes, and snippets.

View tifoaudii's full-sized avatar
🎯
Focusing

Tifo Audi A.P tifoaudii

🎯
Focusing
View GitHub Profile
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)
import UIKit
protocol ListMovieDisplayLogic: AnyObject {
func displayMovies(movie: [Movie])
func displayErrorMessage(error: ErrorResponse)
}
class ListMovieViewController: UITableViewController {
private var movies: [Movie] = []
import Foundation
protocol ListMovieDataLogic {
func fetchMovies()
}
protocol ListMovieDataStore {
var movies: [Movie]? { get }
}
import Foundation
protocol ListMoviePresentationLogic {
func displayMovies(movies: [Movie])
func displayErrorMessage(error: ErrorResponse)
}
class ListMoviePresenter: ListMoviePresentationLogic {
weak var viewController: ListMovieDisplayLogic?
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
@testable import MovieVIP
import XCTest
class ListMovieViewControllerTest: XCTestCase {
// MARK:- Subject Under Test
var sut: ListMovieViewController!
var window: UIWindow!
// MARK:- Test lifecycle
@testable import iRestaurant
import CoreData
class TestCoreDataStack: CoreDataStack {
override init() {
super.init()
//1
let persistentStoreDescription = NSPersistentStoreDescription()
class iRestaurantTests: XCTestCase {
//1
var sut: RestoDataStore!
var coreDataStack: TestCoreDataStack!
//2
override func setUpWithError() throws {
coreDataStack = TestCoreDataStack()
sut = RestoDataStore(
func testBackgroundContextToSaveMenu() {
//1
let backgroundContext = coreDataStack.backgroundContext()
sut = RestoDataStore(
context: backgroundContext,
coreDataStack: coreDataStack
)
expectation(forNotification: .NSManagedObjectContextDidSave, object: backgroundContext)
import UIKit
import Toast
protocol HeroListViewPresentationProtocol: class {
func showHero()
func reloadData()
func showError()
func showInternetConnectionProblemMessage()
}