Suggested approach: Whenever you see some
in a return type, it’s an opaque return type – when you want to specify that some kind of type will be returned, but you don’t want to say what.
It’s important that you try to explain the difference between an opaque return type and returning a protocol, because in the latter your returned value can be absolutely anything whereas in the former the compiler knows what data was actually returned even if you don’t get access to that.
For bonus points, talk about how SwiftUI uses @ViewBuilder
to silently allow us to return different view types from a view body.
Estimated difficulty: Advanced
See the full list of iOS interview questions
Link copied to your pasteboard.