Skip to content

Instantly share code, notes, and snippets.

View caldofran's full-sized avatar

Rubén Méndez caldofran

View GitHub Profile
@caldofran
caldofran / navigation_test.swift
Last active March 6, 2020 15:30
Example of a snapshot navigation test
func testPresentsRightControllerWhenSelectingARow() {
// Given
let navigatorSpy = NavigatorSpy()
let sut = NotificationCenterViewController(navigator: navigatorSpy)
sut.loadViewIfNeeded()
// When
sut.selectRow(at: .init(row: 0, section: 0))
// Then
@caldofran
caldofran / navigation.swift
Last active March 6, 2020 15:36
Model navigation with value types
enum Navigation {
case section(Section)
case push(Screen)
case modal(
Screen,
UIModalPresentationStyle = .fullScreen,
completion: (() -> Void)? = nil
)
}
@caldofran
caldofran / screen_extensions.swift
Created March 6, 2020 15:37
Screen extensions
extension Screen {
static func offer(id: String) -> Self {
return .init() { OfferViewController(id: id) }
}
}
extension Screen {
static func job(id: String) -> Self {
return .init() { JobViewController(id: id) }
}

Keybase proof

I hereby claim:

  • I am caldofran on github.
  • I am caldofran (https://keybase.io/caldofran) on keybase.
  • I have a public key ASCrrDUclWHcFz3S3dA6ju6i-pSFpsFWiqDz-NvoPY2OTQo

To claim this, I am signing this object: