Implementing Coordinator Pattern in SwiftUI
Book

Exploring MusicKit and Apple Music API

Unlock the full power of MusicKit & Apple Music APIs in your apps with the best guide! Use code musickit-blog for a limited-time 35% discount!

Last year, I worked on a project where I had to refactor the app with multiple similar XIBs. I had the option to use SwiftUI to replace the views and the existing structure.

I wanted to have a pattern where I can abstract the navigation from the views to have a separate entity managing them.

After searching, I stumbled across the Coordinator Pattern by Soroush Khanlou. There are a few more inspiration posts I referred to:

I started with my own implementation that suited the project and this post is an implementation of how I went about it.

This is my own view and opinion. I’m happy to hear your views on how you use the coordinator pattern.

Conclusion

Working with SwiftUI is fun and not so fun. For custom scenarios like these, you’ve to resort to UIKit and look for workarounds.

If you have a better approach, please tag @rudrankriyam on Twitter! I love constructive feedback and appreciate constructive criticism.

Thanks for reading, and I hope you’re enjoying it!

Book

Exploring MusicKit and Apple Music API

Unlock the full power of MusicKit & Apple Music APIs in your apps with the best guide! Use code musickit-blog for a limited-time 35% discount!

Written by

Rudrank Riyam

Hi, my name is Rudrank. I create apps for Apple Platforms while listening to music all day and night. Author of "Exploring MusicKit". Apple WWDC 2019 scholarship winner.