No matter how I seem to attempt to conquer this beast, it always beats me down. I cannot (without errors) have a UIImageView inside my UITableViewCell class. I've tried connecting it from the storyboard to the code through a referencing outlet with a strong and a weak storage, writing out the code myself, and even doing without the storyboard and creating a UIImageView programmatically. Is this just a bug with Swift? Am I doing something wrong?
Here's a screenshot of my error:
The UITableViewCell class already has a property by the name of imageView. This is why you cannot create another property with the same name. Try using the already available image view or create an UIImageView instance with a different variable name.
Check the UITableViewCell documentation for more information https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewCell_Class/#//apple_ref/occ/instp/UITableViewCell/imageView
It is not a bug in swift and yes you are doing something wrong. A UITableViewCell class already has certain objects in it which can not be overridden. One of those is imageView. Since the base class of UITableViewCell already has an imageView object you are getting an error since you named your object the same thing. Just change the name to something else that is not part of the base class and it will work. Same thing goes for textLabel, detailTextLabel...etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With