More about the weird behavior of ReferenceWritableKeyPath with an Optional property
问题 (I say "more" in my title because this question is an appendix to my How does Swift ReferenceWritableKeyPath work with an Optional property?.) In my code, self.iv is an outlet property: @IBOutlet weak var iv: UIImageView! Now, will this compile? let im = UIImage() let kp = \UIImageView.image self.iv[keyPath:kp] = im // error No! We are told that something here must be unwrapped, although it is not entirely obvious what it is: Value of optional type 'UIImage?' must be unwrapped to a value of