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 SwiftUI | |
extension CGColor { | |
static let black = CGColor(red: 0, green: 0, blue: 0, alpha: 1) | |
static let white = CGColor(red: 1, green: 1, blue: 1, alpha: 1) | |
} | |
struct CodableColor: Codable { | |
static let black = CodableColor(cgColor: CGColor.black) | |
static let white = CodableColor(cgColor: CGColor.white) |
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 SwiftUI | |
struct DynamicHeightVGrid: Layout { | |
var numberOfColumns: Int | |
var horizontalSpacing: CGFloat | |
var verticalSpacing: CGFloat | |
init( | |
numberOfColumns: Int = 2, | |
horizontalSpacing: CGFloat = 8, |
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 SwiftUI | |
struct SelfSizingSheet: ViewModifier { | |
@State private var height: CGFloat = .zero | |
private struct InnerHeightPreferenceKey: PreferenceKey { | |
static let defaultValue: CGFloat = .zero | |
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | |
value = nextValue() | |
} |
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 testThatDidLogInSuccessfullyCallsRouterNavigateToHomeCalled() { | |
presenter.didLogInSuccessfully() | |
XCTAssertTrue(router.navigateToHomeCalled) | |
} |
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 testThatPerformLogInRequestCallsPresenterDidLogInSuccessfullyOnSuccess() { | |
interactor.username = "Valid Username" | |
interactor.password = "Valid Password" | |
interactor.performLogInRequest() | |
XCTAssertTrue(presenter.didLogInSuccessfullyCalled) | |
} |
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 testThatLogInTappedCallsInteractorPerformLogInRequest() { | |
presenter.logInTapped() | |
XCTAssertTrue(interactor.performLogInRequestCalled) | |
} |
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 testThatLogInButtonTappedCallsPresenterLogInTapped() { | |
viewController.logInButtonTapped() | |
XCTAssertTrue(presenter.logInTappedCalled) | |
} |
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 VIPER_Example | |
import Foundation | |
class MockLoginPresenter: LoginPresenterProtocol, LoginInteractorOutputProtocol { | |
// MARK: - LoginPresenterProtocol | |
var interactor: LoginInteractorInputProtocol? | |
// MARK: - Properties | |
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 | |
// MARK: - View | |
/// Presenter -> ViewController | |
protocol LoginViewProtocol: AnyObject { | |
var presenter: LoginPresenterProtocol? { get set } | |
} | |
// MARK: - Interactor | |
/// Presenter -> Interactor |
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 | |
class LoginModule { | |
func build() -> UIViewController { | |
let view = LoginViewController() | |
let router = LoginRouter() | |
let interactor = LoginInteractor() | |
let presenter = LoginPresenter(interface: view, interactor: interactor, router: router) | |
view.presenter = presenter |
NewerOlder