I create a random number and assign it to the variable randomNumber. Then when I try to append the random number as an index for the emojis array to the empty array arrayOfEmojis I get the error:
'Cannot use mutating member on immutable value: 'self' is immutable'
Im also getting errors from the emoji?
import GameKit
struct EmojiProvider {
var emojis = ["😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "☺️", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍"]
var arrayOfEmojis: [String]
func generateEmoji() -> [String] {
for i in 1...3 {
var randomNumber = GKRandomSource.sharedRandom().nextInt(upperBound: emojis.count)
arrayOfEmojis.append(emojis[randomNumber]) //error!
}
return arrayOfEmojis
}
}