<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ObservedObject/init(wrappedValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI14ObservedObjectV12wrappedValueACyxGx_tcfc"
  },
  "title" : "init(wrappedValue:)"
}
-->

# init(wrappedValue:)

Creates an observed object with an initial wrapped value.

```
@MainActor @preconcurrency init(wrappedValue: ObjectType)
```

## Parameters

`wrappedValue`

An initial value for the observable object.

## Discussion

Don’t call this initializer directly. Instead, declare
an input to a view with the `@ObservedObject` attribute, and pass a
value to this input when you instantiate the view. Unlike a
[`StateObject`](/documentation/SwiftUI/StateObject) which manages data storage, you use an observed
object to refer to storage that you manage elsewhere, as in the
following example:

```
class DataModel: ObservableObject {
    @Published var name = "Some Name"
    @Published var isEnabled = false
}

struct MyView: View {
    @StateObject private var model = DataModel()

    var body: some View {
        Text(model.name)
        MySubView(model: model)
    }
}

struct MySubView: View {
    @ObservedObject var model: DataModel

    var body: some View {
        Toggle("Enabled", isOn: $model.isEnabled)
    }
}
```

Explicitly calling the observed object initializer in `MySubView` would
behave correctly, but would needlessly recreate the same observed object
instance every time SwiftUI calls the view’s initializer to redraw the
view.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)