I am making a swift app. It is a trivia app for fun and I have run into an issue that I havent seen before. (I am new to swift and ios development errors)
impor
Solution 1 : Your code is not inside a method, you have to wrap it inside the method. Check this stackoverflow answer
Solution 2 : Keep your questions and answers
inside struct
and access them, if you don't want to wrap it inside a function.
struct firstQuestion {
static var question = "What was the first planet to be discovered using the telescope, in 1781?"
static var answerOne = "Mercury"
static var answerTwo = "Uranus"
static var answerThree = "Venus"
static var answerFour = "Jupiter"
static var correctAnswer = "Correct Answer"
}
var questionOneArray = [firstQuestion.answerOne, firstQuestion.answerTwo, firstQuestion.answerThree, firstQuestion.answerFour, firstQuestion.correctAnswer]