# SwiftUI: properties

> Learn how to add properties to a SwiftUI view and use them in your text, like a name constant interpolated into a Text view to greet the user.

Author: Flavio Copes | Published: 2021-09-17 | Canonical: https://flaviocopes.com/swiftui-properties/

You can add any property to any [SwiftUI](https://flaviocopes.com/swiftui-introduction/) view, like this:

```swift
import SwiftUI

struct ContentView: View {
    let name = "Flavio"
    
    var body: some View {
        Text("Hello, \(name)!")
            .font(.largeTitle)
    }
}
```

![Xcode showing SwiftUI code with name property and iPhone simulator displaying Hello, Flavio!](https://flaviocopes.com/images/swiftui-properties/Screen_Shot_2021-09-13_at_14.55.12.png)

See how I used `let` because the property is a constant.

Note this, because later we'll see how to update a property value by tapping a button.

Here is another example with an integer variable:

```swift
import SwiftUI

struct ContentView: View {
    let name = "Flavio"
    let age = 38
    
    var body: some View {
        VStack {
            Text("Hello, \(name)!")
                .font(.largeTitle)
            Text("You are \(age) years old")
        }
    }
}
```

![Xcode showing SwiftUI code with name and age properties and iPhone simulator displaying Hello, Flavio! You are 38 years old](https://flaviocopes.com/images/swiftui-properties/Screen_Shot_2021-09-13_at_15.11.39.png)
