# data separation

[terms](https://lochiwei.gitbook.io/ios/master/term) ⟩ data separation &#x20;

{% hint style="success" %}
The concept that an app's <mark style="color:orange;">data model</mark> should be <mark style="color:yellow;">defined separately</mark> from the <mark style="color:yellow;">user interface</mark> used to display and interact with that data.

<mark style="color:purple;">Data separation</mark> allows you to <mark style="color:yellow;">modify</mark> the data model and UI <mark style="color:yellow;">independently</mark> of each other, makes it easier to understand how your app works, and improves the testability of your app.
{% endhint %}

## Examples

{% tabs %}
{% tab title="1" %}

```swift
import SwiftUI

struct ContentView: View {

    // ⭐️ view state (data)
    @State var isOn = true
    
    // ⭐️ user interface
    var body: some View {
        // ...
    }
    
}
```

{% endtab %}
{% endtabs %}
