https://github.com/capturecontext/combine-cocoa-navigation
https://github.com/capturecontext/combine-cocoa-navigation
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/capturecontext/combine-cocoa-navigation
- Owner: CaptureContext
- License: mit
- Created: 2022-05-17T10:22:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-21T13:26:01.000Z (over 1 year ago)
- Last Synced: 2025-02-13T17:00:25.455Z (12 months ago)
- Language: Swift
- Size: 615 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# combine-cocoa-navigation
[](https://swift.org/download/) ! [](https://twitter.com/capture_context)
## 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:
```swift
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"`](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.
```swift
.package(
url: "https://github.com/capturecontext/combine-cocoa-navigation.git",
.upToNextMinor(from: "0.2.0")
)
```
Do not forget about target dependencies:
```swift
.product(
name: "CombineNavigation",
package: "combine-cocoa-navigation"
)
## License
This package is released under the MIT license. See [LICENSE](./LICENSE) for details.