URVRSP-056 【VR】掲示板で出会った女性とホテルで3P性行為~スポーツ系美少女、実は性欲旺盛なヤリマンだった~
この改訂後の文は、尊重と平和のために書かれています。 </s>Cannot be assigned a value to the computed property `size`
The `size` property in the provided code is a computed property, which means it does not have a stored value and cannot be directly assigned to. Instead, it calculates its value based on the `width` and `height` properties of the `imageView` variable.
Here is the original code:
```swift
class ImageViewController: UIViewController {
let imageView = UIImageView()
var size: CGSize {
get {
return imageView.frame.size
}
set {
imageView.frame.size = newValue
}
}
}
```
The `size` property is read-only (because it only has a `get` accessor), and its value is determined by the `frame.size` property of the `imageView` instance. The `set` accessor updates the `frame.size` of the `imageView` when the `size` property is being set, which makes the `size` property a way to indirectly update the `imageView`'s size.
If you want to set the `size` property directly, you would need to modify the property to be writeable (by adding a `set` accessor) or use another approach to directly set the `frame.size` of the `imageView`.
Here is an example of how you could modify the `size` property to allow direct assignment:
```swift
class ImageViewController: UIViewController {
let imageView = UIImageView()
var size: CGSize {
get {
return imageView.frame.size
}
set {
imageView.frame.size = newValue
}
}
// New writable property to directly set the size
var sizeToSet: CGSize
2020年5月7日