Reputation: 31
I am trying to control drop two UILabels onto a UIViewController. I keep receiving Cannot override strong property with weak property error.
Here is a short excerpt from my code. Here is a screenshot of all the errors https://gyazo.com/bd97fa42443d12a3aa17a2de55f78b60
import UIKit
class ViewController: UIViewController {
@IBOutlet private weak var display: UILabel!
@IBOutlet private weak var description: UILabel!
private var userIsInTheMiddleOfTyping = false
@IBAction private func touchDigit(_ sender: UIButton) {
let digit = sender.currentTitle!
if (digit == "c") {
display.text = " "
} else {
print("touchDigit \(digit) digit")
if userIsInTheMiddleOfTyping {
let textCurrentlyInDisplay = display.text
if (sender.currentTitle!) == "c" {
print("it printed c")
display.text = "sam"
Upvotes: 0
Views: 177
Reputation: 117
You should declare your UILabels with optional type UILabel?
instead UILabel!
Upvotes: 0
Reputation: 318774
You need to rename your description
variable since description
is the name of a method inherited from NSObject
(the base class of UIViewController
).
Upvotes: 1