Skip to content

CaptureContext/combine-cocoa-navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

combine-cocoa-navigation

SwiftPM 5.8 ! @maximkrouk

Usage

Basically all you need is to call configureRoutes method of the viewController, it accepts routing publisher and routeConfigurations, your code may look somewhat like this:

final class MyViewController: UIViewController {
  // ...
  
  func bindViewModel() {
    configureRoutes(
      for viewModel.publisher(for: \.state.route),
      routes: [
        // Provide mapping from route to controller
        .associate(makeDetailsController, with: .details)
      ],
      onDismiss: { 
        // Update state on dismiss
        viewModel.send(.dismiss)
      }
    ).store(in: &cancellables)
  }
}

Installation

Basic

You can add CombineNavigation to an Xcode project by adding it as a package dependency.

  1. From the File menu, select Swift Packages › Add Package Dependency…
  2. Enter "https://github.com/capturecontext/combine-cocoa-navigation.git" into the package repository URL text field
  3. Choose products you need to link them to your project.

Recommended

If you use SwiftPM for your project, you can add CombineNavigation to your package file.

.package(
  url: "https://github.com/capturecontext/combine-cocoa-navigation.git", 
  .upToNextMinor(from: "0.2.0")
)

Do not forget about target dependencies:

.product(
  name: "CombineNavigation", 
  package: "combine-cocoa-navigation"
)

## License

This package is released under the MIT license. See [LICENSE](./LICENSE) for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages