I am new to Swift and have tried some lessons to learn and polish my knowledge in Swift. I came across an error above in this code that I did not understand. If any of you have an idea, please explain what is wrong here.
let textChoices = [
ORKTextChoice(text: "Create a ResearchKit app", value:0),
ORKTextChoice(text: "Seek the Holy grail", value:1),
ORKTextChoice(text: "Find a shrubbery", value:2)
]
I solved the error by suggesting Xcode and now my code looks like
let textChoices = [
ORKTextChoice(text: "Create a ResearchKit app", value:0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Seek the Holy grail", value:1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Find a shrubbery", value:2 as NSCoding & NSCopying & NSObjectProtocol)
]
There is another solution that I got from answer . Although it works, I still do not quite understand the problem and solution. What concept is missing.
source
share