# Property wrapper initialisation issues

**URL:** <https://forums.swift.org/t/property-wrapper-initialisation-issues/62407>\
**Category:** Using Swift\
**Tags:** init, propertywrapper, decodable\
**Created:** [January 5, 2023, 3:48pm UTC](https://forums.swift.org/t/property-wrapper-initialisation-issues/62407 "2023-01-05T15:48:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjrscott](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jjrscott/32/12494_2.png) [@jjrscott](https://forums.swift.org/u/jjrscott)\
**Post date:** [January 5, 2023, 3:48pm UTC](https://forums.swift.org/t/property-wrapper-initialisation-issues/62407/1 "2023-01-05T15:48:42Z")

</div>

tl;dr How do I ensure my a property wrapper's `init()` is called when wrapped by another property wrapper, and how do I get to keep those values when decoding?

```swift
struct Cow: Decodable {
    @Rules(deletion: .cascade) var field1: Field
    @Wrapper @Rules(deletion: .nullify) var field2: Field
}

```

When I decode this the following calls occur:

```swift
- Rules<Field>.init(deletion: .cascade)
- Wrapper<Rules<Field>>.init()
> Cow.init(from:)
	> Rules<Field>.init(from:)
		- Field.init(from:)
	< Rules<Field>.init(from:)
	- Rules<Field>.deinit
	> Wrapper<Rules<Field>>.init(from:)
		> Rules<Field>.init(from:)
			- Field.init(from:)
		< Rules<Field>.init(from:)
	< Wrapper<Rules<Field>>.init(from:)
	- Wrapper<Rules<Field>>.deinit
< Cow.init(from:)

```

Two problems occur:

- `Rules<Field>.init(deletion: .cascade)` is overwritten but the later `Rules<Field>.init(from:)`
- `Rules<Field>.init(deletion: .nullify)` is not called at all.

I can see why the overwrite happens, but very much wish to avoid. The non-call is just plain weird.
