1
Technical Interview Questions
2
Code Output Prediction (SwiftUI & State Management)
1. Что выведется при взаимодействии с этим кодом?
final class Counter: ObservableObject {
@Published var value = 0
init() {
print("Counter init call")
}
deinit() {
print("Counter deinit call")
}
func increment() {
value += 1
}
}
struct ContentView: View {
@State private var value = 0
var body: some View {
let _ = print("ContentView call body with value == (value)")
VStack {
Text("Значение счетчика: (value)")
.font(.title2)
CounterView(value: $value)
}
.frame(width: 400, height:…