Skip to content

Instantly share code, notes, and snippets.

View nickm01's full-sized avatar

Nick McConnell nickm01

  • Turo
  • San Francisco
View GitHub Profile
class NavigationFlowTests: XCTestCase {
func test_navigates_whenTapNext() throws {
let sut = FlowVM()
XCTAssertEqual(sut.navigationPath.count, 0)
let screen1VM = sut.makeScreen1VM()
screen1VM.didTapNext()
XCTAssertEqual(sut.navigationPath.count, 1)
}
}
class FlowVM: ObservableObject {
var subscription = Set<AnyCancellable>()
func makeScreen1VM() -> Screen1PhoneVM {
let vm = Screen1VM(phoneNumber: model.phoneNumber)
vm.didComplete
.sink(receiveValue: didComplete1)
.store(in: &subscription)
return vm
@nickm01
nickm01 / swiftui4.navigationstack.swift
Last active July 27, 2022 20:10
SwiftUI Basic NavigationStack
class FlowVM: ObservableObject {
@Published var navigationPath = NavigationPath()
func navigateTo2() {
navigationPath.append(2)
}
func navigateTo3() {
navigationPath.append("1")
}