misguided
misguided

Reputation: 3789

special characters/emoji assignment issue in swift

I am following the audacity code . The following line throws error in Xcode.

let translations = [String : String]()
    override init() {
        super.init()

        translations["heart"] = "\u{0001F496}"
        translations["fish"] = "\u{E522}"
  }

both translations assignment lines are throwing error "cannot assign to the result of this expression"

Can you kindly advise what is the issue with the code above?

Upvotes: 0

Views: 74

Answers (1)

Lucas Huang
Lucas Huang

Reputation: 4016

let translations = [String : String]() makes translations immutable. Use var instead.

Upvotes: 1

Related Questions