How do I solve?
This is my code:
import UIKit
class ViewController: UIViewController {
var flipCount = 0 {
didSet {
flipCountLabel.text = "Flips: \(flipCount)"
}
}
@IBOutlet weak var flipCountLabel: UILabel!
// in this area appears the Thread 1: breakpoint 1.1 2.1 (in the line of "flipCount += 1")
@IBAction func touchCard( sender: UIButton) {
flipCount += 1
flipCard(withEmoji: "👻", on: sender)
}
@IBAction func touchSecondCard( sender: UIButton) {
flipCount += 1
flipCard(withEmoji: "🎃", on: sender)
}
func flipCard(withEmoji emoji: String, on button: UIButton) {
if button.currentTitle == emoji {
button.setTitle("", for: UIControl.State.normal)
button.backgroundColor = colorLiteral(red: 1, green: 0.5763723254, blue: 0, alpha: 1)
} else {
button.setTitle(emoji, for: UIControl.State.normal)
button.backgroundColor = colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}
}
}
This is my code:
import UIKit
class ViewController: UIViewController {
var flipCount = 0 {
didSet {
flipCountLabel.text = "Flips: \(flipCount)"
}
}
@IBOutlet weak var flipCountLabel: UILabel!
// in this area appears the Thread 1: breakpoint 1.1 2.1 (in the line of "flipCount += 1")
@IBAction func touchCard( sender: UIButton) {
flipCount += 1
flipCard(withEmoji: "👻", on: sender)
}
@IBAction func touchSecondCard( sender: UIButton) {
flipCount += 1
flipCard(withEmoji: "🎃", on: sender)
}
func flipCard(withEmoji emoji: String, on button: UIButton) {
if button.currentTitle == emoji {
button.setTitle("", for: UIControl.State.normal)
button.backgroundColor = colorLiteral(red: 1, green: 0.5763723254, blue: 0, alpha: 1)
} else {
button.setTitle(emoji, for: UIControl.State.normal)
button.backgroundColor = colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}
}
}