#0 iOS — Reinventing view controller navigation

present & push… For how long?

Aron Balog

--

Through my career, I dealt with dozen different ways of navigating through screens (a.k.a. view controllers). Honestly, I never felt “safe” while using Apple’s navigation APIs.

presentViewController:animated:completion:pushViewController:animated:

Wrapping these into some reusable components helped on some occasions but only temporarily. In environments where screen navigation is frequently used functionality, reusing such components can be very unthankful and frustrating as making a breaking change may result in an exhausting refactor across the whole stack.

I expected to see some moves from Apple on this topic since “the big refactor” (release of iOS 7 and iOS 8). I couldn’t be more wrong — so obviously, nothing happened. These minimalistic APIs for navigation are good enough for the simple use cases. But we live in a world where developers are spoiled and expect at least:

  • APIs for data passing between screens (view controllers)
  • APIs for conditional navigation (e.g. user is not allowed to open certain parts of the app)
  • easier handling of state restoration
  • URL navigation (deep linking)
  • caching
  • navigation history handling (like browsers do)

I stepped into the maze of potential solutions and created a new one. Many of these mentioned things are wrapped and powered by simple APIs.

CoreNavigation extends UIKit with additional features and tools helping you handle navigation use cases in few lines of code.

If you have any questions, remarks or advice it would be my pleasure to discuss it with you.

In the following posts, I will try to explain how to useCoreNavigation.

Next posts:

--

--

Aron Balog

Unstoppable coder, passionate about software architecture, primarily focused on iOS development. https://github.com/aronbalog | https://twitter.com/Aron_Balog