fivestars.blog fivestars.blog

SwiftUI patterns: passing & accepting views

When building advanced screens, at some point our view definitions will need to accept external views as parameters for maximum flexibility. This is something SwiftUI solves beautifully via composition, which we covered in Composing SwiftUI views. In this article let’s explore how SwiftUI itself use this pattern, and what kind of variants there are. Explict types When a view wants to offer some flexibilty but still expect a certain...