0

He guys, I know there are a lot of similar questions but the don't help me, so please give me a advice what is wrong/what I can do to solve this error

Declaration:

enter image description here

Usage of variables with the error:

enter image description here

1 Answers1

0

You try to use property values inside other property values, but properties are initialised before type init called, so instance is not ready yet, ie dependent properties might not be ready for such operation and compiler prevents such try.

The easiest solution for your case is to make dependent property lazy, because lazy will be initialised on first call, so instance is ready at that time:

lazy var TableViewDetailValues = [ ... ]

also it is possible to make it calculable:

var TableViewDetailValues: [String] { [ ... ] }
Asperi
  • 228,894
  • 20
  • 464
  • 690