I'm trying to connect a label from my prototype cell of the storyboard to my view controller. Every time I do this I get an error saying "Outlets cannot be connected to repeating content". I don't know why its doing that because I don't where I'm repeating the content but I've provide an image below. Just so you don't get confused the green comments that say "TOP cell: user post" the outlets are connected to the top of the view controller where you see user, message and time. I just want to create outlets from the prototype cell to the view controller without getting this error. I hope this was enough information.
How do I solve this error with "Outlets cannot be connected to repeating content"?
3.4k Views Asked by JoshyJay At
2
At run time, there might be zero instances of that cell, or one instance, or 100 instances, depending on how many rows your table view has. Each cell will have its own instance of that label. Which label do you think the outlet should be connected to? There is no good answer.
Anyway, when the view controller is loaded, there are definitely zero instances of the cell, so there is nothing to connect such an outlet to. The cell instances are created later, after the storyboard scene has been fully loaded, by
tableView(_:cellForRowAtIndexPath:)
callingdequeueReusableCellWithIdentifier(_:)
repeatedly.