Sobes.tech
Junior — Senior

Comparison of data storage methods in View: external value vs @State

livecode

Task condition

Demonstrate the difference between two SwiftUI views: one receives data externally through a constant, and the other stores it in internal state using the @State property.

struct SuccessView: some View {
    let message: String

    var body: some View {
        Text("Number is: \(message)")
    }
}

struct DemoSuccessView: some View {
    @State var message: String

    var body: some View {
        Text("Number is: \(message)")
    }
}
Comparison of data storage methods in View: external… - sobes.tech