It turns out that Attempt 2 works even with initial viewWidth = .zero. However, the problem is that if I insert the banner in a List, viewDidAppear(animated:) never triggers, so width never gets updated.
Does anyone know how to work around this?
Post
Replies
Boosts
Views
Activity
What I'm trying to work out now is if I should have known this already?
Earlier in the course, we were told to use the auto-fix and just leave it at that because "we wouldn't need the default implementation of init()" again. There wasn't any other similar problem. I think the author thought we'd be able to figure it out given what we'd learned before.
Your solution works. My guess why the auto-fix provides the error message instead of the basic implementation like yours is that since you're providing custom init() implementation with an extra parameter, you might also want to override the default implementation, which the error is aimed to remind you of.
Some labs and exercises are so vague in the course. It's as if the author expected us to know what they were thinking.