user187676
user187676

Reputation:

IB doesn't detect wrong IBOutlet type

Lets say I connect an weak var myView: UIImageView! outlet to an UIImageView instance in my XIB or Storyboard. Later I change the view class in IB to UIView. The outlet will still be connected without giving a warning or compile time error.

Can I somehow automatically detect such errors?

Upvotes: 1

Views: 28

Answers (1)

Bisma Saeed
Bisma Saeed

Reputation: 827

UIView is parent class of UIImageView, so you can connect UIImageView with UIView but you can't connect a UIView to UIImageView. So technically, it is not an error.

Upvotes: 2

Related Questions