Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import UIKit

protocol LuzHomeCoordinatorProtocol {
func start()
}

final class LuzHomeCoordinator: LuzHomeCoordinatorProtocol {
private var window: UIWindow?

public init(window: UIWindow?) {
self.window = window
}

func start() {
let navigationController = LuzHomeFactory.make()
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import UIKit

enum LuzHomeFactory {
static func make() -> UINavigationController {
UINavigationController(rootViewController: LuzHomeViewController())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
enum LuzLoginEmailValidatorError: Error {
case invalidEmail
case emptyEmail
}

enum LuzLoginEmailValidator {
static func validate(_ email: String?) throws {
guard let email, !email.isEmpty else {
throw LuzLoginEmailValidatorError.emptyEmail
}

let emailRegex = #"^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"#
guard email.range(of: emailRegex, options: .regularExpression) != nil else {
throw LuzLoginEmailValidatorError.invalidEmail
}
}
}
8 changes: 8 additions & 0 deletions CleanCodeApp/Modules/Features/Luz/Login/LuzLoginFactory.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import UIKit

enum LuzLoginFactory {
static func make() -> UIViewController {
let viewModel = LuzLoginViewModel()
return LuzLoginViewController(viewModel: viewModel)
}
}
Loading