-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LoansDetailViewControllerFactory
Migrate LoansDetail to VIP
- Loading branch information
Showing
6 changed files
with
115 additions
and
65 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
SWDestinyTrades/Classes/LoanDetail/Factory/LoansDetailViewControllerFactory.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// LoansDetailViewControllerFactory.swift | ||
// SWDestinyTrades | ||
// | ||
// Created by Diogo Autilio on 25/02/24. | ||
// Copyright © 2024 Diogo Autilio. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
final class LoansDetailViewControllerFactory: ViewControllerFactory { | ||
|
||
private let database: DatabaseProtocol? | ||
private let person: PersonDTO | ||
|
||
init(database: DatabaseProtocol?, person: PersonDTO) { | ||
self.database = database | ||
self.person = person | ||
} | ||
|
||
func createViewController() -> UIViewController { | ||
let view = LoanDetailTableView() | ||
let viewController = LoansDetailViewController(with: view) | ||
let router = LoanDetailNavigator(viewController) | ||
let presenter = LoansDetailPresenter(controller: viewController, | ||
database: database, | ||
person: person, | ||
navigator: router) | ||
viewController.presenter = presenter | ||
view.loansDetailDelegate = presenter | ||
return viewController | ||
} | ||
} |
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
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
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
32 changes: 32 additions & 0 deletions
32
SWDestinyTradesTests/Screens/LoanDetail/Factory/LoansDetailViewControllerFactoryTests.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// LoansDetailViewControllerFactoryTests.swift | ||
// SWDestinyTradesTests | ||
// | ||
// Created by Diogo Autilio on 25/02/24. | ||
// Copyright © 2024 Diogo Autilio. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
|
||
@testable import SWDestinyTrades | ||
|
||
final class LoansDetailViewControllerFactoryTests: XCTestCase { | ||
|
||
private var sut: LoansDetailViewControllerFactory! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
sut = LoansDetailViewControllerFactory(database: nil, | ||
person: .stub()) | ||
} | ||
|
||
override func tearDown() { | ||
sut = nil | ||
super.tearDown() | ||
} | ||
|
||
func test_controller_creation() { | ||
XCTAssertNotNil(sut.createViewController()) | ||
} | ||
} |