---
title: "Discussion on \"Clean, Simple and Composable Routing in Swift for iOS Apps - Part 1\" | Hashnode"
description: "Discussion on \"Clean, Simple and Composable Routing in Swift for iOS Apps - Part 1\". Clean, Simple and Composable Routing for iOS Apps\nThis is the first part of a series of articles about a Clean, Simple and Composable Routing for iOS apps.\nOne of the hottest topics in the iOS community is view controller orchestration. There are man..."
url: "https://hashnode.com/posts/clean-simple-and-composable-routing-for-ios-apps/5e6c2365bc8844135ba495b1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Clean, Simple and Composable Routing in Swift for iOS Apps - Part 1](https://cassiuspacheco.com/clean-simple-and-composable-routing-for-ios-apps?utm_source=hashnode&utm_medium=feed)

Clean, Simple and Composable Routing for iOS Apps This is the first part of a series of articles about a Clean, Simple and Composable Routing for iOS apps. One of the hottest topics in the iOS community is view controller orchestration. There are man...

Mar 14, 2020 · 12 min read · cassiuspacheco.com  
Updated Feb 26, 2024  
Read the article

-   [#swift](https://hashnode.com/tag/swift)
-   [#software-architecture](https://hashnode.com/tag/software-architecture)
-   [#routing](https://hashnode.com/tag/routing)
-   [#ios](https://hashnode.com/tag/ios)

## Written by

[Cassius Pacheco](https://hashnode.com/@cassiuspacheco)

@cassiuspacheco · Sydney, Australia

  
[View profile](https://hashnode.com/@cassiuspacheco)

Brazilian Software Engineer living in Australia 🇧🇷 🇦🇺 | Dart | Flutter | Swift | iOS

My life changed in 2011 when I fell in love with iPhone and started working as an iOS Developer. I'm passionate about clean and effective code, code review, organisation, agile work, sharing knowledge and experiences, but above all I'm passionate about building awesome products.

## Responses 1

Markdown supported · ⌘↵ to post

[Ana](https://hashnode.com/@anitai26)

[May 10, 2021](https://hashnode.com/posts/clean-simple-and-composable-routing-for-ios-apps/5e6c2365bc8844135ba495b1/comment/60991b3a21068818a5c63f7b)

Hi Cassius! This is an amazing approach, thank you very much for sharing it.

I'm having a problem that I hope you can help me to solve. I'm trying to change programmatically the tab, I was able to do it from my router like this:

```
func changeTo(tab: Tabs, _ completion: (() -> Void)?) {
     if root?.tabBarController?.selectedIndex != tab.rawValue {
           root?.tabBarController?.selectedIndex = tab.rawValue
     }

     completion?()
}
```

But when I do that, the router system doesn't recognise that the tab have been changed so the main router isn't the new visible view.

Do you have any ideas of how to solve this? Thanks in advance!
