It happened for me to write following code snippet in one of my UIViewControllers in my new iOS Swift Application.
var starButtonsCount = starButtons.count
@IBOutlet var starButtons: [UIButton]!
Then straight next to the starButtonsCount variable declaration following error appeared in red.
Error: Cannot use instance member ‘starButtons’ within property initializer; property initializers run before ‘self’ is available.
So I found out that by declaring the starButtonCount variable as lazy we can resolve this error (temporary in the long run of the iOS App development process).
I'm curious to find out what are the other methods to solve this?
Is there a way to trigger the initialization for starButtonCount when the starButtons IBOutlets get initialized?