<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>karlbowden.com</title>
    <description>Karl Bowden, King of Karlsbadia
</description>
    <link>https://karlbowden.com/</link>
    <atom:link href="https://karlbowden.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 05 May 2016 04:49:48 +0000</pubDate>
    <lastBuildDate>Thu, 05 May 2016 04:49:48 +0000</lastBuildDate>
    <generator>Jekyll v3.1.1</generator>
    
      <item>
        <title>Retro Spec: Suggest an interview</title>
        <description>&lt;p&gt;You may have noticed the interview series I have been working on: &lt;a href=&quot;https://loomstate.fm/retro/&quot;&gt;Retro Speculative&lt;/a&gt;. They are very personal interviews with people involved in the Apple developer community.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;But I need your help!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I would really like to talk people in under-represented and quieter sections of the community. Including - but not limited to - &lt;strong&gt;female developers&lt;/strong&gt; or &lt;strong&gt;developers with disabilities&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Tell your story, share your experiences, good and bad. What are you working on? What are you proud of? Tell the community what we can do to be more inclusive and welcoming.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You don&amp;rsquo;t have to have all the answers to be valued.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Are you interested in chatting? Who would you like to hear an interview with?&lt;/p&gt;

&lt;p&gt;Send me a message on twitter - &lt;a href=&quot;https://twitter.com/karlbowden&quot;&gt;@karlbowden&lt;/a&gt;, an email - &lt;a href=&quot;mailto:karl@loomstate.fm&quot;&gt;karl@loomstate.fm&lt;/a&gt; or use the &lt;a href=&quot;https://loomstate.fm/contact/&quot;&gt;contact form&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Thu, 05 May 2016 02:55:00 +0000</pubDate>
        <link>https://karlbowden.com/suggest-an-interview/</link>
        <guid isPermaLink="true">https://karlbowden.com/suggest-an-interview/</guid>
        
        <category>LoomState</category>
        
        <category>Retro Speculative</category>
        
        <category>Podcast</category>
        
        
      </item>
    
      <item>
        <title>Sydney Cocoaheads ReSwift Prezzo</title>
        <description>&lt;blockquote&gt;
&lt;p&gt;What follows are the notes from my talk at the Sydney Cocoaheads meetup, March 17th on &lt;strong&gt;Unidirectional State Flow in Swift - programming without paradox&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It was such an encouraging group to talk to. Interestingly, most people followed along, but I wasn&amp;rsquo;t expecting such a &amp;lsquo;penny-drop&amp;rsquo; moment with the demo. Maybe I should have started with the demo?&lt;/p&gt;

&lt;p&gt;Slide content has not been transcribed, and some slides have been left out for the sake of brevity. Links are listed inline where possible.&lt;/p&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-1.png&quot;&gt;&lt;/div&gt;

&lt;h2 id=&quot;unidirectional-state-flow-in-swift-programming-without-paradox&quot;&gt;Unidirectional State Flow in Swift &lt;br&gt; - programming without paradox&lt;/h2&gt;

&lt;p&gt;What am I doing? Encouraging experimentation, with a &lt;em&gt;lightening&lt;/em&gt; introduction, to the principles of Unidirectional State Flow, and how they apply to application design in Swift.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-3.png&quot;&gt;&lt;/div&gt;

&lt;h2 id=&quot;what-is-unidirectional-state-flow&quot;&gt;What is Unidirectional State Flow?&lt;/h2&gt;

&lt;p&gt;It is a set of principles for controlling state handing in applications.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://martinfowler.com/eaaDev/EventSourcing.html&quot;&gt;Variations&lt;/a&gt; have been around for a while. The one we are interested in is &lt;a href=&quot;http://redux.js.org&quot;&gt;Redux&lt;/a&gt;, the JavaScript framework by &lt;a href=&quot;https://twitter.com/dan_abramov&quot;&gt;Dan Abramov&lt;/a&gt;. Other variations can also bee seen frameworks like &lt;a href=&quot;http://elm-lang.org&quot;&gt;Elm&lt;/a&gt; and &lt;a href=&quot;http://cycle.js.org&quot;&gt;Cycle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At a high level, the &lt;a href=&quot;http://redux.js.org/docs/introduction/ThreePrinciples.html&quot;&gt;base principles&lt;/a&gt; we are concerned about are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;That state only travels in one direction&lt;/li&gt;
&lt;li&gt;That state is immutable&lt;/li&gt;
&lt;li&gt;And that state is only modified by pure functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last two might sound contradictory, so, before we jump into the application of these principals, it helps to understand what we mean by State.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-4.png&quot;&gt;&lt;/div&gt;

&lt;h1 id=&quot;what-is-state&quot;&gt;What is State?&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;state&lt;/strong&gt;, &lt;em&gt;noun&lt;/em&gt; &lt;br&gt;
  the particular condition that someone or something is in &lt;strong&gt;at a specific time&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Notice those words? &lt;em&gt;At a specific time&lt;/em&gt;. They are very important words that are often missed in the definition of State. Because:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h3 id=&quot;although-state-changes-over-time-the-state-at-any-particular-point-in-time-is-fixed&quot;&gt;Although state changes over time, &lt;br&gt; the state at any particular point in time is fixed.&lt;/h3&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-5.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Therefore, the whole idea of creating an application revolves around time streams.&lt;/p&gt;

&lt;p&gt;An application is, at it&amp;rsquo;s heart, a representation of a stream of states through time, that a user can interact with.&lt;/p&gt;

&lt;p&gt;But we all write applications already. So what is the big deal then?&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-6.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;When learning application development, there is so much minutiae to deal with.
And as programmers, we are often stubborn, and impatient.&lt;/p&gt;

&lt;p&gt;Because we have so many other things to remember, we want to get concepts up and running quickly. Which leads to either not knowing how to, or not getting around to refactoring for maintainability.&lt;/p&gt;

&lt;p&gt;It leads to state in your View. But we know that in MVC we can solve this by refactoring. And now you have Massive View Controllers.&lt;/p&gt;

&lt;p&gt;But we can refactor that too. And now there&amp;rsquo;s state in all the things.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-7.png&quot;&gt;&lt;/div&gt;

&lt;h2 id=&quot;hasn-39-t-this-already-been-solved&quot;&gt;Hasn&amp;rsquo;t this already been solved?&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Yes&lt;/strong&gt;, we have MVVM!&lt;/p&gt;

&lt;p&gt;But MVVM is about the separation of concerns, between views and models - and that includes state, but it does not specify how to handle, and interact with, a stream of states over time.&lt;/p&gt;

&lt;p&gt;By now you have probably guessed, this sounds a lot like an advertisement for Functional Reactive Programming.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-8.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;And that is because your right.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FRP&lt;/strong&gt; is all about dealing with a &lt;strong&gt;stream of values over time&lt;/strong&gt; in a &lt;strong&gt;functional and declarative&lt;/strong&gt; way.&lt;/p&gt;

&lt;p&gt;Remember our definition of an application? An application is a representation of &lt;strong&gt;state over time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We see these abstractions a lot in other fields too, such as Physics.&lt;/p&gt;

&lt;p&gt;Speed for example, represents a measurement of distance over time.
With time being constant and moving forward.&lt;/p&gt;

&lt;p&gt;Think about the concepts and how they relate:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h2 id=&quot;speed-is-distance-over-time-like-an-application-is-state-over-time&quot;&gt;Speed is distance over time &lt;br&gt; Like an Application is state over time&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-9.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;So&amp;hellip;.. If we already have reactive frameworks, then why do we need ReSwift?&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-10.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;As soon as you have multiple sources or streams of state, there is nothing stopping them from mutating, deviating and creating forks in the continuum.&lt;/p&gt;

&lt;p&gt;Now you have a potential paradox.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-11.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;And by paradox, we mean &lt;strong&gt;this&lt;/strong&gt;. The state stream has forked somewhere and now both these the components are doing what they are told, but displaying different state.&lt;/p&gt;

&lt;p&gt;Sigh.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-12.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;If they are streams can&amp;rsquo;t we just join them back up?&lt;/p&gt;

&lt;p&gt;You could &lt;em&gt;if&lt;/em&gt; you have &lt;strong&gt;paradox driven tests&lt;/strong&gt;, but until then, I think we all know how dangerous it is to cross the streams.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-13.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;ReSwift is FRP for your &lt;em&gt;whole application state&lt;/em&gt;, but simplified into Unidirectional State Flow principals.&lt;/p&gt;

&lt;p&gt;In essence, it is the &lt;strong&gt;theory of relativity in a framework&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;And it is: &lt;strong&gt;programming without paradox&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But just like time travel, it introduces an abundance of terms that can seem daunting to start with.&lt;/p&gt;

&lt;p&gt;State, Store, Actions, Reducers, Dispatchers, Subscribers, Middleware, etc&lt;/p&gt;

&lt;p&gt;So lets break them down and see how they all fit together.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-14.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Luckily a picture speaks a thousand words.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-15.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Most importantly, this is your &lt;strong&gt;store&lt;/strong&gt;. It &lt;strong&gt;controls the flow of state over time&lt;/strong&gt;. It &lt;em&gt;is&lt;/em&gt; your &lt;strong&gt;TARDIS&lt;/strong&gt;. It has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One entry point for actions&lt;/li&gt;
&lt;li&gt;One port, that freezes time, for reducing / producing a new state&lt;/li&gt;
&lt;li&gt;And one exit point for subscribing to state updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each component of an application, can only interact with dispatch, and subscribe.&lt;/p&gt;

&lt;p&gt;But you don&amp;rsquo;t want to tie all of your application components directly to the store. That would defeat the purpose.&lt;/p&gt;

&lt;p&gt;So using protocols each component can subscribed to, just a subset of the state that it is concerned about.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h4 id=&quot;store-controls-the-flow-of-state-over-time&quot;&gt;Store: controls the flow of state over time&lt;/h4&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-16.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;With our theory kinda on-track and store outlined, we need to divert and have a quick look at restructuring application components. In a Todo app for example we might have a List View and an Item View.&lt;/p&gt;

&lt;p&gt;Each of these application components get divided into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input and Output&lt;/strong&gt;, which are &lt;strong&gt;State&lt;/strong&gt; and &lt;strong&gt;Actions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Side effects&lt;/strong&gt;, such as API calls, get &lt;strong&gt;initiated by Action Creators&lt;/strong&gt; and &lt;strong&gt;pushed to the edges&lt;/strong&gt; into &lt;strong&gt;Middleware and Services&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;State mutation&lt;/strong&gt; is separated into &lt;strong&gt;Reducers&lt;/strong&gt;. You&amp;rsquo;ll remember, they are the ones that &lt;strong&gt;pause time while they calculate a new state&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-17.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;How do we decide what goes into State, Reducers and Action Creators?&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;application state&lt;/strong&gt; needs to provide enough information &amp;ndash; at any point in time &amp;ndash; to satisfy all of the application components displayed. So we analyse each of our components. Ask them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What information do we need to provide to it?&lt;/li&gt;
&lt;li&gt;And what actions does it produce?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This normally separates nicely into Input and Output, dependency protocols. You will probably recognise that it looks a lot like a View Model. When our component is connected to a view model that conforms to these protocols, it keeps it nicely isolated from the store.&lt;/p&gt;

&lt;p&gt;For a Todo List we would likely have a list of todo items to display, a set of filters, such as Available, Overdue and Completed, and the currently selected filter.&lt;/p&gt;

&lt;p&gt;The List would also produce actions &amp;ndash; user initiated by touch events &amp;ndash; such as when a user changes the filter, or selects an item.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-18.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Each of these sub-divisions, State, Actions and Reducers, are composable and nestable.&lt;/p&gt;

&lt;p&gt;Each are simplified down to a single responsibility, then stacked like lego to create the store.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This means each component and store item is &lt;strong&gt;mockable&lt;/strong&gt;, &lt;strong&gt;replacable&lt;/strong&gt;, and &lt;strong&gt;testable in isolation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Both outside of the store, AND outside of view controllers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-20.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;So far, I have shown a very over simplified explanation.&lt;/p&gt;

&lt;p&gt;So before we continue let me preface the rest with some warnings.&lt;/p&gt;

&lt;p&gt;I am &lt;strong&gt;NOT&lt;/strong&gt; saying every application should be structured in this way. I am simply advocating experimentation.&lt;/p&gt;

&lt;p&gt;ReSwift might be &lt;strong&gt;too complex&lt;/strong&gt; or even &lt;strong&gt;too simple&lt;/strong&gt; for your application, and sometimes even removing ReSwift is the right decision.&lt;/p&gt;

&lt;p&gt;Suppose you were to go DIY and wanted to create your own store, lets look at the minimum you would need.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-21.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;From our history lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We know that the &lt;strong&gt;State&lt;/strong&gt; and &lt;strong&gt;Action&lt;/strong&gt; are &lt;strong&gt;value types&lt;/strong&gt; that get passed around&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Reducer&lt;/strong&gt; and &lt;strong&gt;Subscriber&lt;/strong&gt; are &lt;strong&gt;function types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;And the &lt;strong&gt;Store&lt;/strong&gt; is just a protocol tying them all together, to &lt;strong&gt;control the flow of State&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-22.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Then we just need to scaffold out a store.&lt;/p&gt;

&lt;p&gt;It needs to be initialised with a &lt;strong&gt;Reducer&lt;/strong&gt; and &lt;strong&gt;initial state&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And components need to be able to &lt;strong&gt;subscribe to state updates&lt;/strong&gt;, and &lt;strong&gt;dispatch actions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That is it for the base Store. I know I glossed over the base types, we will see those in more detail in a future demo.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-23.png&quot;&gt;&lt;/div&gt;

&lt;h3 id=&quot;finally-when-is-reswift-a-good-fit&quot;&gt;Finally, when is ReSwift a good fit?&lt;/h3&gt;

&lt;p&gt;When you have multiple components presenting the same same state, or when you have multiple sources of actions that can effect the state.&lt;/p&gt;

&lt;p&gt;And good for pushing side effects out to the edges of an application, such as dealing with APIs that you call, or that can push back in events.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-24.png&quot;&gt;&lt;/div&gt;

&lt;h3 id=&quot;what-is-reswift-not-a-good-fit-for&quot;&gt;What is ReSwift not a good fit for?&lt;/h3&gt;

&lt;p&gt;Simple applications that can already be reasoned about in your head. They don&amp;rsquo;t need to be made unnecessarily complicated.&lt;/p&gt;

&lt;p&gt;Applications with large state &amp;ndash; such as binary data &amp;ndash; that should not all be kept in memory at once.&lt;/p&gt;

&lt;p&gt;Applications where you would have to deal with large numbers of unthrottled actions. Because it would require pausing time and running reducers every time an action is dispatched.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-25.png&quot;&gt;&lt;/div&gt;

&lt;h3 id=&quot;common-pitfalls&quot;&gt;Common Pitfalls&lt;/h3&gt;

&lt;p&gt;As you might have guessed, &lt;strong&gt;reducers need to be fast&lt;/strong&gt;. You should not sort an array inside a reducer every time an action is dispatched.&lt;/p&gt;

&lt;p&gt;Reducers should not cause side effects. Remember, time is paused. There are specific rules and safe guards to stop you from trying to dispatch a new action from inside a reducer and cause a paradox.&lt;/p&gt;

&lt;p&gt;You still need to watch out for globals. They cause coupling, unknown side effects and make testing unnecessarily hard. And can easily be avoided using coordinators or flow-controllers.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-26.png&quot;&gt;&lt;/div&gt;

&lt;h3 id=&quot;now-for-what-you-all-came-to-see-the-tooling-around-reswift&quot;&gt;Now for what you all came to see: the tooling around ReSwift.&lt;/h3&gt;

&lt;p&gt;Using a coordinator and router, lets us keep an application de-coupled, and recreate and jump to any stack of views in the application.&lt;/p&gt;

&lt;p&gt;Then using the ReSwift Recorder for time travel we can record and replay actions and move through the time stream of an application.&lt;/p&gt;

&lt;p&gt;My personal favourite is code injection - when I haven&amp;rsquo;t broken it. Although it&amp;rsquo;s not a part of ReSwift, it makes for a great combination when you can hot reload classes from both Objective C and swift. With KZPlayground you can also isolate view components and treat them like playgrounds inside the simulator.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-27.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Do we have any good examples? Have a look at &lt;a href=&quot;https://itunes.apple.com/us/app/charter-mailing-list-client/id1082212697?ls=1&amp;amp;mt=8&quot;&gt;Charter&lt;/a&gt;, by &lt;a href=&quot;https://twitter.com/_matthewpalmer&quot;&gt;Matthew Palmer&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Swift mailing list client for iOS&lt;/li&gt;
&lt;li&gt;Available in the App Store&lt;/li&gt;
&lt;li&gt;Open source by default, h/t Artsy&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/matthewpalmer/Charter&quot;&gt;github.com/matthewpalmer/Charter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Most interestingly, he recently made the decision to remove ReSwift to reduce the barrier to entry to new contributors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-28.png&quot;&gt;&lt;/div&gt;

&lt;h3 id=&quot;ride-by-fablic-inc&quot;&gt;&lt;a href=&quot;https://itunes.apple.com/jp/app/id1088140538&quot;&gt;バイクフリマアプリ RIDE&lt;/a&gt; by Fablic, Inc&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Bike Flea Market App - RIDE&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-29.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Now I need to make shout out to all our contributors. Especially &lt;a href=&quot;https://twitter.com/benjaminencz&quot;&gt;Ben&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/ARendtslev&quot;&gt;Aleskander&lt;/a&gt; for generously allowing me opportunities to contribute during the early stages.&lt;/p&gt;

&lt;p&gt;You may have heard of ReduxKit and Swift-Flow. They are the original projects by Aleksander and Ben that we merged into ReSwift.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-30.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;We welcome new contributors, and the discussion on GitHub is especially help full. Tell us what worked for you and what didn&amp;rsquo;t.&lt;/p&gt;

&lt;p&gt;It also turns out ReSwift is big in Japan. I have no idea what they are saying about it, but I would help to translate documentation.&lt;/p&gt;

&lt;p&gt;For similar projects, have a look at &lt;a href=&quot;https://github.com/thoughtbot/Delta&quot;&gt;Delta&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/jakecraige&quot;&gt;Jake Craige&lt;/a&gt; at &lt;a href=&quot;https://twitter.com/thoughtbot&quot;&gt;thoughtbot&lt;/a&gt;
and &lt;a href=&quot;https://github.com/yonekawa/SwiftFlux&quot;&gt;SwiftFlux&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/yonekawa&quot;&gt;Kenichi Yonekawa&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;SwiftFlux is based on the Flux framework that the inspiration for Redux was based out of.&lt;/p&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-31.png&quot;&gt;&lt;/div&gt;

&lt;p&gt;Where to next?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Project and documentation on GitHub:

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/ReSwift/ReSwift&quot;&gt;github.com/ReSwift/ReSwift&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://reswift.github.io/ReSwift/&quot;&gt;ReSwift documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realm.io/news/benji-encz-unidirectional-data-flow-swift/&quot;&gt;Benjamin Encz: Unidirectional Data Flow in Swift / Realm presentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Have a look at the &lt;a href=&quot;https://github.com/reactjs/redux&quot;&gt;Redux&lt;/a&gt; project. The code is readable and easy enough to port to swift. As well as &lt;a href=&quot;https://egghead.io/series/getting-started-with-redux&quot;&gt;Dan Abramovs excellent video series on EggHead&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr&gt;

&lt;div class=&#39;feature-image&#39;&gt;&lt;img src=&quot;/assets/paradox/paradox-slide-32.png&quot;&gt;&lt;/div&gt;
</description>
        <pubDate>Tue, 22 Mar 2016 12:26:33 +0000</pubDate>
        <link>https://karlbowden.com/reswift-prezzo/</link>
        <guid isPermaLink="true">https://karlbowden.com/reswift-prezzo/</guid>
        
        <category>ReSwift</category>
        
        <category>Swift</category>
        
        <category>Cocoaheads</category>
        
        
      </item>
    
      <item>
        <title>Shared Instance episode 50</title>
        <description>&lt;p&gt;A big shout out to &lt;a href=&quot;https://twitter.com/SamCorder&quot;&gt;Sam Corder&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/ajrobinson&quot;&gt;Alex Robinson&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/alexargo&quot;&gt;Alex Argo&lt;/a&gt; (I&amp;rsquo;ll catch you next time Argo).&lt;/p&gt;

&lt;p&gt;I had the pleasure of talking to Sam and Alex on &lt;a href=&quot;http://sharedinstance.com/50&quot;&gt;SharedInstance episode 50&lt;/a&gt; about &lt;a href=&quot;https://github.com/ReSwift/ReSwift&quot;&gt;ReSwift&lt;/a&gt; and life.
I really appreciate the extended amount of time they both took to make it happen.&lt;/p&gt;

&lt;p&gt;It turns out there is a lot of whitespace in my head when recording (problem with my mic?), so I highly recommend using smart speed in Overcast to anybody thinking about listening to the episode.&lt;/p&gt;
</description>
        <pubDate>Sun, 28 Feb 2016 21:51:35 +0000</pubDate>
        <link>https://karlbowden.com/shared-instance-episode-50/</link>
        <guid isPermaLink="true">https://karlbowden.com/shared-instance-episode-50/</guid>
        
        <category>Podcast</category>
        
        <category>Guest</category>
        
        <category>Link</category>
        
        
      </item>
    
      <item>
        <title>Quick Start: Hot reloading in Swift</title>
        <description>&lt;p&gt;Hot-reloading swift classes really is quite simple, thanks to &lt;a href=&quot;https://github.com/johnno1962&quot;&gt;John Holdsworth&lt;/a&gt;&amp;rsquo;s AWESOME &lt;a href=&quot;https://github.com/johnno1962/injectionforxcode&quot;&gt;Injection Plugin for Xcode&lt;/a&gt;.&lt;/p&gt;

&lt;video src=&#39;/assets/swift-hot-reload.mp4&#39; preload=&#39;meta&#39; controls&gt;&lt;/video&gt;

&lt;h2 id=&quot;the-tl-dr&quot;&gt;The TL;DR:&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repo: &lt;a href=&quot;https://github.com/johnno1962/injectionforxcode&quot;&gt;https://github.com/johnno1962/injectionforxcode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Open in Xcode and run &lt;strong&gt;Build&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Restart Xcode, and click &amp;lsquo;Load Bundles&amp;rsquo;&lt;/li&gt;
&lt;li&gt;Restart Xcode again&lt;/li&gt;
&lt;li&gt;Open a project&lt;/li&gt;
&lt;li&gt;Add a new Objective-C file called &lt;code&gt;main.m&lt;/code&gt; (if one doesn&amp;rsquo;t already exist)&lt;/li&gt;
&lt;li&gt;Also, add the bridging header when prompted&lt;/li&gt;
&lt;li&gt;From the menu select &lt;strong&gt;Product &amp;gt; Injection Plugin &amp;gt; Patch Project for Injection&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;From the menu: &lt;strong&gt;Product &amp;gt; Injection Plugin &amp;gt; Tunable App Parameters&lt;/strong&gt; and enable &lt;strong&gt;File Watcher&lt;/strong&gt; (and Inject Storyboards if you use them)&lt;/li&gt;
&lt;li&gt;Recompile and run the project&lt;/li&gt;
&lt;li&gt;Open a swift file, make changes and save&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TADA&lt;/strong&gt;. The file will be recompiled and injected into the running app&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;notes&quot;&gt;Notes:&lt;/h2&gt;

&lt;p&gt;The injection only works for objects that can be swizzled. Which means only classes that inherit from &lt;code&gt;NSObject&lt;/code&gt;. If you add or remove classes or files, the project will also need to be rebuilt.&lt;/p&gt;

&lt;p&gt;If you have issues with file not found errors in the console when saving, check that Xcode is set to store derived data in the default location.&lt;/p&gt;

&lt;p&gt;To perform actions on classes when they are reloaded, add an injected function to them:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NSObject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;injected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// I will run when my class is reloaded&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will only be called on the class that is replaced. If you want to receive notifications whenever a class is changed you can use NSNotificationCenter:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NSObject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;NSNotificationCenter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;defaultCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addObserver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;interjected:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;INJECTION_BUNDLE_NOTIFICATION&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;interjected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;notification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NSNotification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;notification&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;INJECTION_BUNDLE_NOTIFICATION&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;INTERJECTED&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;wrap-up&quot;&gt;Wrap up&lt;/h2&gt;

&lt;p&gt;You will definitely also want to check out &lt;a href=&quot;https://github.com/krzysztofzablocki/KZPlayground&quot;&gt;KZPlayground&lt;/a&gt; for using hot-reloading and adjustable parameters on the fly and &lt;a href=&quot;https://github.com/ReSwift/ReSwift&quot;&gt;ReSwift&lt;/a&gt; for replaying the event and calculating state after reloading.&lt;/p&gt;

&lt;p&gt;If you make something interesting with it, let me know: &lt;a href=&quot;https://twitter.com/karlbowden&quot;&gt;@karlbowden&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 21 Feb 2016 21:32:12 +0000</pubDate>
        <link>https://karlbowden.com/quick-start-hot-reloading-in-swift/</link>
        <guid isPermaLink="true">https://karlbowden.com/quick-start-hot-reloading-in-swift/</guid>
        
        <category>Beginner</category>
        
        <category>Here be dragons</category>
        
        <category>Dragons of AWESOME!</category>
        
        
      </item>
    
      <item>
        <title>View Routing Concepts in Swift</title>
        <description>&lt;p&gt;It&amp;rsquo;s uncommon to see a backend web framework without a router. It makes sense. The web is built around URL&amp;rsquo;s that naturally branch out to routes.&lt;/p&gt;

&lt;p&gt;Since the rise of frontend frameworks, routers have become a natural fit there too. Plus there is no shortage of choice for routers.&lt;/p&gt;

&lt;p&gt;The function of a UI router is fairly simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Formalise the &lt;strong&gt;separation&lt;/strong&gt; of views components&lt;/li&gt;
&lt;li&gt;Compose components into a &lt;strong&gt;structure&lt;/strong&gt; of routes and matchers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle URL changes&lt;/strong&gt; by matching it to a path of routes and returning the routes to a coordinator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That really is all there is to it, and it&amp;rsquo;s something we have been doing for a long time with &lt;a href=&quot;http://khanlou.com/2015/01/the-coordinator/&quot;&gt;coordinator&lt;/a&gt; and &lt;a href=&quot;http://merowing.info/2016/01/improve-your-ios-architecture-with-flowcontrollers/&quot;&gt;presenter&lt;/a&gt; patterns. The router is essentially a set of helper functions for declaring these patterns.&lt;/p&gt;

&lt;p&gt;It is especially helpful when combined with state and side-effect separation. With very specific advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Because components are now &lt;strong&gt;isolated&lt;/strong&gt;, their structure can easily be rearranged&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;concerns&lt;/strong&gt; of view components are &lt;strong&gt;simplified&lt;/strong&gt; to presentation of state, and generating actions from user input&lt;/li&gt;
&lt;li&gt;Services and APIs now only interact with the state store&lt;/li&gt;
&lt;li&gt;Each section of the application is easily &lt;strong&gt;testable AND replaceable&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Presentation behaviour can be changed based on device or screen size, or swapped out entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point you can probably guess the frontend web frameworks that implement these patterns (in part or whole): Elm, Cycle, Redux, React, Angular, Vue, etc. Familiarity with these frameworks is not necessary though, as we are concerned more with how to apply the concepts behind them in our swift applications.&lt;/p&gt;

&lt;h2 id=&quot;introducing-featherweight-router&quot;&gt;Introducing Featherweight Router&lt;/h2&gt;

&lt;p&gt;The main main downside to implementing routers in iOS has been the amount of boilerplate code it requires. I have repeated the pattern often enough that it warranted moving into a project of it&amp;rsquo;s own. Hence I &lt;a href=&quot;https://karlbowden.com/featherweight-router-tldr/&quot;&gt;introduce&lt;/a&gt; to you the &lt;a href=&quot;https://github.com/featherweightlabs/FeatherweightRouter&quot;&gt;Featherweight Router&lt;/a&gt; project. It was designed to be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simple&lt;/strong&gt; - it doesn&amp;rsquo;t need to be complicated to be useful and powerful.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Purposefully has no dependencies&lt;/strong&gt; - the routing layer should be lightweight and easily replaced&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Not concerned with State&lt;/strong&gt; - Although it&amp;rsquo;s recommended to use a Unidirectional State Flow implementation such as ReSwift, the State Store should remain separate, replaceable and testable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Not tied to presentation&lt;/strong&gt; - The router does control presentation, but is not concerned with HOW it is presented. You are free to use UIKit, AppKit, TVKit, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Extendable&lt;/strong&gt; - The base router type does not implement any route handling behaviour, it&amp;rsquo;s all done through Router creators.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Featherweight Router doesn&amp;rsquo;t make any decisions for you outside of declaring a route structure. You still need to choose a UI framework, how to handle route changes and where to store state.&lt;/p&gt;

&lt;h2 id=&quot;wrapping-up&quot;&gt;Wrapping up&lt;/h2&gt;

&lt;p&gt;Want to learn more? Check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;a href=&quot;https://karlbowden.com/featherweight-router-tldr/&quot;&gt;code heavy tl;dr introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://github.com/featherweightlabs/FeatherweightRouter&quot;&gt;Featherweight Router&lt;/a&gt; project on GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My sources of inspiration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://khanlou.com/2015/01/the-coordinator/&quot;&gt;The Coordinator&lt;/a&gt; by &lt;a href=&quot;http://www.twitter.com/khanlou&quot;&gt;Soroush Khanlou&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://merowing.info/2016/01/improve-your-ios-architecture-with-flowcontrollers/&quot;&gt;Improve your iOS Architecture with FlowControllers&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/merowing_&quot;&gt;Krzysztof Zabłocki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/devxoul/URLNavigator&quot;&gt;URLNavigator&lt;/a&gt; by &lt;a href=&quot;https://github.com/devxoul&quot;&gt;Jeon Suyeol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://chris.eidhof.nl/posts/functional-view-controllers.html&quot;&gt;Functional View Controllers&lt;/a&gt; by &lt;a href=&quot;http://www.twitter.com/chriseidhof/&quot;&gt;Chris Eidhof&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a special thank you to every person promoting the use of solid functional patterns.&lt;/p&gt;
</description>
        <pubDate>Thu, 18 Feb 2016 02:16:15 +0000</pubDate>
        <link>https://karlbowden.com/view-routing-concepts-in-ios/</link>
        <guid isPermaLink="true">https://karlbowden.com/view-routing-concepts-in-ios/</guid>
        
        <category>Entry Level</category>
        
        <category>Conceptual</category>
        
        
      </item>
    
      <item>
        <title>Featherweight Router tl;dr</title>
        <description>&lt;p&gt;You don&amp;rsquo;t want to read &lt;a href=&quot;https://karlbowden.com/view-routing-concepts-in-ios/&quot;&gt;background story&lt;/a&gt;, it&amp;rsquo;s very conceptual, and it&amp;rsquo;s too long. This is the opinionated, essentials only version you are looking for.&lt;/p&gt;

&lt;p&gt;Introducing &lt;a href=&quot;https://github.com/featherweightlabs/FeatherweightRouter&quot;&gt;Featherweight Router&lt;/a&gt;. It&amp;rsquo;s like a washing machine that separates laundry automatically.&lt;/p&gt;

&lt;h2 id=&quot;what&quot;&gt;What?&lt;/h2&gt;

&lt;p&gt;A collection of functions and patterns (coordinators and presenters) for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separating view controllers&lt;/li&gt;
&lt;li&gt;Constructing routers&lt;/li&gt;
&lt;li&gt;Matching a route to a path of view controllers&lt;/li&gt;
&lt;li&gt;Updating the presentation of view controllers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;

&lt;p&gt;To maintain a separation of concerns.&lt;/p&gt;

&lt;h2 id=&quot;how-items-not-specific-to-routing&quot;&gt;How? (&lt;em&gt;Items not specific to routing&lt;/em&gt;)&lt;/h2&gt;

&lt;h3 id=&quot;store&quot;&gt;Store&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Store: dispatcher of actions and returner of state&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A &lt;a href=&quot;https://realm.io/news/benji-encz-unidirectional-data-flow-swift/&quot;&gt;Unidirectional State Flow&lt;/a&gt; Store. &lt;a href=&quot;http://reswift.github.io/ReSwift/&quot;&gt;ReSwift&lt;/a&gt; etc. Referenced here primarily so we don&amp;rsquo;t have to talk about &lt;code&gt;State&lt;/code&gt; any further.&lt;/p&gt;

&lt;h3 id=&quot;view-controllers&quot;&gt;View Controllers&lt;/h3&gt;

&lt;p&gt;Nothing router specific here. Just make sure they are testable and isolated. Pass requirements via protocols at or after instantiation time.&lt;/p&gt;

&lt;h3 id=&quot;view-presenters&quot;&gt;View Presenters&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;typealias&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Presenter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ViewController&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;typealias&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;PresenterCreator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Presenter&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// ie&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;somePresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Presenter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;viewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;viewModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeViewModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Inject the &lt;code&gt;Store&lt;/code&gt; and other properties when creating a presenter. The presenter returns a view controller when called.&lt;/p&gt;

&lt;h2 id=&quot;how-routing-specific&quot;&gt;How? (&lt;em&gt;Routing specific&lt;/em&gt;)&lt;/h2&gt;

&lt;p&gt;Routers match and set routes, then pass the matched presenters to &lt;code&gt;RouterDelegate&lt;/code&gt;s for display.&lt;/p&gt;

&lt;h3 id=&quot;routerdelegate-routerdelegate-lt-t-gt&quot;&gt;RouterDelegate: &lt;code&gt;RouterDelegate&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cliffs notes edition&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;presenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Wraps a presenter and provides hooks for updating the display of the current route.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delegate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;presenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;somePresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you &lt;em&gt;go full router&lt;/em&gt;, you&amp;rsquo;ll hardly every use a Presenter without wrapping it in a &lt;code&gt;RouterDelegate&lt;/code&gt;. So just go and combine them all in your next refactor.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;someLazyPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;ViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;viewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;viewModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeViewModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;router-router-lt-t-gt&quot;&gt;Router: &lt;code&gt;Router&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Nailed the delegates? Well done. Now get routing!&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cliffs notes edition&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;presenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;handlesRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;getStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]?&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;setRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Void&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;handlesRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)?&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;setRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)?&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;getStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]?)?&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Oh. Yeah. Not so fast, the base router doesn&amp;rsquo;t actually do anything other than hold a collection of routing functions. Each router type is an extension to the &lt;code&gt;Router&lt;/code&gt;. They take a router, modify it&amp;rsquo;s behaviour and return a new router. Onward then.&lt;/p&gt;

&lt;h3 id=&quot;junction-router-uitabbarcontroller&quot;&gt;Junction Router &lt;code&gt;=~ UITabBarController&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/junction.gif&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cliffs notes&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;junction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;junctions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Router junctions match against child routes and passes the array of direct descendants to setChildren, and the matched route to setChild.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tabBar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UITabBarController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tabBarPresenter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;getPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;setChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selectedViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;setChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setViewControllers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;someJunctionRouter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tabBarPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;junction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;someRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;anotherRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;stack-router-uinavigationcontroller&quot;&gt;Stack Router &lt;code&gt;=~ UINavigationController&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/stack.gif&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cliffs notes&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Router stacks match against children in the same way as junctions, but pass a nested stack of presenters to setChildren instead.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;stack&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UINavigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;navigationPresenter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;getPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;setChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;setChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setViewControllers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;someStackRouter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;navigationPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;someRouteWithChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;anotherRouteWithChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;named-route-uiviewcontroller&quot;&gt;Named Route &lt;code&gt;=~ UIViewController&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;And lastly, Named Routes, the endpoints of a matched route. Construct a route with a presenter, then assign it a name and optionally some children.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cliffs notes&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Name patterns are evaluated as regex matches and can be used for selecting id&amp;rsquo;s or values from URL segments. The matched segment values are not passed to the delegate automatically, the &lt;code&gt;ViewModel&lt;/code&gt;s are expected to derive the URL segment values from state.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;someRouter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/mammal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/mammal/cow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/mammal/pig&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/fish&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/fish/salmon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/fish/trout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Using regex&#39;s for matching&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;someRouter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;w+&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;animal/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;w+/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;w+&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;Last thing left is to scaffold out a shell for our app. The following code only covers the basic use case to illustrate where router creation happens and how it fits into the coordinator and initialisation. We will start from the &lt;code&gt;AppDelegate&lt;/code&gt; and work our way down.&lt;/p&gt;

&lt;p&gt;Lines marked with &lt;code&gt;external&lt;/code&gt; are outside the scope of this intro, as opinions and framework choices for those components will vary per project. As are the &lt;code&gt;ViewController&lt;/code&gt;s and &lt;code&gt;ViewModel&lt;/code&gt;s.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIKit&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;FeatherweightRouter&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;typealias&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Store&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ExternalStore&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;@UIApplicationMain&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;AppDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIResponder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIApplicationDelegate&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIApplication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;didFinishLaunchingWithOptions&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;launchOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;NSObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;AnyObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]?)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

        &lt;span class=&quot;n&quot;&gt;window&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIScreen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mainScreen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rootViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;appCoordinator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;makeKeyAndVisible&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;appCoordinator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;appStore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &amp;lt;- EXTERNAL&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;router&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;appRouter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;state&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &amp;lt;- EXTERNAL&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setRoute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;some-initial-path&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;presenter&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;appRouter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// UITabBarController&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;tabBarPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;junction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;// Welcome tab: UINavigationController&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;navigationPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Welcome&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mockPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Welcome&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
                &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mockPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Register&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome/register&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
                &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mockPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Login&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome/login&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;// About tab&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mockPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;About&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;about&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;tabBarPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tabBarController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UITabBarController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;getPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBarController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;setChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBarController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selectedViewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;setChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tabBarController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setViewControllers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;navigationPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;navigationController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UINavigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;navigationController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tabBarItem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;getPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;navigationController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;setChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;setChildren&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;navigationController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setViewControllers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mockPresenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MockViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;MockViewModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RouterDelegate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viewController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Your move. These &lt;code&gt;mockPresenters&lt;/code&gt; aren&amp;rsquo;t going to turn into something amazing on their own.&lt;/p&gt;
</description>
        <pubDate>Sun, 14 Feb 2016 04:44:24 +0000</pubDate>
        <link>https://karlbowden.com/featherweight-router-tldr/</link>
        <guid isPermaLink="true">https://karlbowden.com/featherweight-router-tldr/</guid>
        
        <category>Terse</category>
        
        <category>Code heavy</category>
        
        
      </item>
    
  </channel>
</rss>
