Question: Stored property without initial value prevents synthesized initializers (Swift/Xcode). I have a struct of a crossword board as such (you can ignore the values) struct

Stored property without initial value prevents synthesized initializers (Swift/Xcode).

I have a struct of a crossword board as such (you can ignore the values)

struct Board1 { var rowLocation : [Int] = [0,1,6,8,16,31,50,53,60,67,93] var rowDirection : [Character] = ["r","d","d","d","r","r","d","d","r","d","r"] var rowContent : [String] = ["ivory","vigor","after","bronze","fire","oath","fate","magic","attack","mini","casting"] }

I wanted to create a variable called State and set it equal to this Struct called Board1 so in my main viewController I used:

var state : Board1

I get this error "Stored property without initial value prevents synthesized initializers" as well as "ViewController has no initializers". Any idea where I'm messing up here? It all happens when I place that one line var state : Board1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!