The Pragmatic Ball boy

iOSを中心にやってる万年球拾いの老害エンジニアメモ

@propertyDelegateと@propertyWrapperの違い

2019/06/25 現在の情報

Swift EvolutionのProperty Wrappersを見ると@propertyWrapper ですが、

AppleのドキュメントのStateを見ると @propertyDelegateになっています。

f:id:yanamura:20190625135622p:plain
state

原因

仕様策定段階で名前が変わった

詳細

ここに書いてあるように最初はproperty delegatesだったのがproperty wrappersに名前が変わったそうです。

The name of the feature has been changed from "property delegates" to "property wrappers" to better communicate how they work and avoid the existing uses of the term "delegate" in the Apple developer community

AppleWWDCに間に合わせるために未fixの段階で実装していれこんじゃったために古い名前になっているようです。

Renamed the value property to wrappedValue to avoid conflicts.

こちらのvalueがwrappedValueに名前が変わる変更もbeta2の段階では反映されておらず、valueにしないとコンパイルに通りません。