Eduardo Ferreira
Eduardo Ferreira

Reputation: 25

Quotation marks not works correctly

I dont know how I can use this:

"\(something)"

With this:

"\(otherthing)"

Like that:

 botaoA.setTitle("\(myAnswers[myQuestions.indexOfObject("\(myQuestions.new)")][0])", forState: UIControlState.Normal)

But the quotation marks not works corretly..

Upvotes: 1

Views: 43

Answers (2)

Ale Mohamad
Ale Mohamad

Reputation: 392

The answer by Avt is very correct, but the code is not great to read. My suggestion is that you should separate the elements of your code:

let questionIndex = myQuestions.indexOfObject("\(myQuestions.new)")
let selectedAnswer = myAnswers[questionIndex][0]
botaoA.setTitle(selectedAnswer, forState: UIControlState.Normal)

Upvotes: 2

Avt
Avt

Reputation: 17043

Difficult to guess but I think you need

botaoA.setTitle("\(myAnswers[myQuestions.indexOfObject(myQuestions.new)][0])", forState: UIControlState.Normal)

Upvotes: 0

Related Questions