Suggested approach: If it weren’t for the built-in restriction, this would be easy to answer with @State
, @EnvironmentObject
, and more, but with that restriction in place you need to be more creative – what real example can you think of? For example, a wrapper to make sure numbers are never negative, or strings are never empty, or perhaps arrays that silently stay sorted.
Estimated difficulty: Intermediate
Watch me answer this question in detail
See the full list of iOS interview questions
Link copied to your pasteboard.