Here is my class.
class dictionaryWord Object
{
@objc dynamic var word: String?
@objc dynamic var Defination: String?
@objc dynamic var dateCreated: Date?
}
What I am trying to do is that my Definition is too long so I want to split it by the commas and display the text as a new line. The code I have printed all elements array in the console but it only prints the last element on the text label. Thanks.
let definationSplit = "\(String(describing: (wordOfDay.Defination!)))"
let completedSplit: [String] = definationSplit.components(separatedBy: ",")
word.text = "\(String(describing: (wordOfDay.word!)))"
for (index,element) in completedSplit.enumerated() {
wordDescription.text = "\(index),\(element)"
print (index,"\u{2022}",element)
}