@Published
property wrapper do?Suggested approach: As with many questions, the best answer here starts with a simple definition (when used inside an ObservableObject
an @Published
property will automatically send out change notifications when its value changes), then diving into a practical example. So, you might say that a class you’re using in SwiftUI has an array of todo list items, and when that array changes the UI should update – a simple, real-world use for @Published
.
Estimated difficulty: Easy
Watch me answer this question in detail
See the full list of iOS interview questions
Link copied to your pasteboard.