You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because **classic App Navigation** introduces **tight coupling** between ViewControllers.
15
+
Complex Apps navigation can look like a **gigantic spider web**.
16
+
17
+
Besides the fact that **Navigation responsibility is split** among ViewControllers, modifying a ViewController can cascade recompiles and produce **slow compile times.**
18
+
19
+
## How
20
+
By using a Navigation `enum` to navigate we decouple ViewControllers between them. Aka they don't know each other anymore. So modifying `VCA` won't trigger `VCB` to recompile anymore \o/
A cool side effect of extracting navigation logic on big projects is improving compilation times.
25
-
Indeed Strong dependencies due to navigation code often makes Xcode recompile files you never modified. Router enables you to extract your routing logic in a separate file.
27
+
Navigation code is now encapsulated in a `AppNavigation` object.
26
28
29
+
## Benefits
30
+
-[x] Decouples ViewControllers
31
+
-[x] Makes navigation Testable
32
+
-[x] Faster compile times
27
33
28
34
## Get started
29
35
30
36
### 1 - Declare your Navigation enum
31
37
```swift
32
38
enumMyNavigation: Navigation {
33
39
caseabout
40
+
caseprofile(Person)
34
41
}
35
42
```
43
+
Swift enum can take params!
44
+
Awesome for us because that's how we will pass data between ViewControllers :)
0 commit comments