1

Why am I getting this warning for the choosePerson function below? Why won't it use the function?enter image description here

@IBAction func beginGameButton(_ sender: UIButton) {
    **choosePerson()**. *Result of call to 'choosePerson()' is unused*
    sender.isHidden = true

}

@IBAction func reveal(_ sender: UIButton) {
    let picture = choosePerson().image
    personImage.image = UIImage(named: picture)

}

func choosePerson() -> Family {
    let chosenPerson = familyList.removeFirst()
    questionLabel.text = chosenPerson.hint

    return chosenPerson
}
G. Sikkema
  • 11
  • 1
  • Please do not use images of error messages, they have little value in this context. Include the actual text. Also, do not link to off site resources as they have a habit of disappearing, rending the question valueless. To answer your question: You are calling a function that returns a result, but you never store that result in a variable, hence the warning. Doing the following: `_ = choosePerson()` would suppress the warning, however you would be discarding whatever choice was made. Seems like you have a logic issue. – Tibrogargan Jul 11 '18 at 19:47
  • Thank you. New to stack so I appreciate the help and advice. – G. Sikkema Jul 11 '18 at 20:31

0 Answers0