Skip to content

Commit 3e793bb

Browse files
committed
Update readme
1 parent d795747 commit 3e793bb

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,47 @@ final class OrdersRouter: SwiftUINavigationRouterProtocol { ... }
196196

197197
---
198198

199+
## ☝️ One more thing...
200+
201+
### 🚀 Simplify Your Navigation with `NavigationRouterView`
202+
203+
**Bored and tired of repeatedly defining `navigationDestination` everywhere?** Let `NavigationRouterView` handle everything for you!
204+
205+
### 🎯 Why `NavigationRouterView`?
206+
207+
-**Simplified Setup**: Define your navigation logic once and reuse it effortlessly across your app.
208+
-**Cleaner Code**: No more repetitive `navigationDestination` setups cluttering your SwiftUI views.
209+
-**Easy Maintenance**: Centralized routing makes your navigation easy to maintain and scale.
210+
211+
### ⚙️ How Does It Work?
212+
213+
`NavigationRouterView` uses a simple yet powerful protocol `NavigationRouterProtocol`, which lets you define navigation paths and corresponding views neatly in one place.
214+
215+
### Set Up `NavigationRouterView`
216+
217+
Simplify your view by embedding it within `NavigationRouterView`:
218+
219+
```swift
220+
struct HomeView: View {
221+
@StateObject private var router = MyRouter()
222+
223+
var body: some View {
224+
NavigationRouterView(router: router) {
225+
VStack {
226+
Button("Push Detail View") {
227+
router.push(screen: .detailView)
228+
}
229+
}
230+
.navigationTitle("Home")
231+
}
232+
}
233+
}
234+
```
235+
236+
That's it! 🎉 Now your navigation is cleaner, modular, and easier than ever!
237+
238+
---
239+
199240
## 📱 Example App
200241

201242
A basic working example is available inside the [`ExampleApp`](./ExampleApp) folder.

0 commit comments

Comments
 (0)