SwiftUI is an amazing framework that makes building user interfaces on iOS a breeze. One of the most powerful features of SwiftUI is the ability to visualize your views in real-time using Xcode Previews. However, as you may have experienced, these previews can sometimes crash and cause frustration.
In this video, I'll be sharing with you the common reasons why your previews may be crashing, and, more importantly, how to fix them. I'll be going over two simple and easy methods that you can use to get your previews working again in no time. Whether you're a beginner or an experienced developer, these tips will be helpful in resolving preview errors.
I hope you'll enjoy the video and find it helpful in your SwiftUI development journey. A special thanks to Noam for inspiring me to create this video.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Contents of the video
00:00 - Intro
04:00 - Solution 01: Using protocols
08:40 - Solution 02: Using view composition
12:50 - Conclusion