How to solve "No exact matches in call to instance method 'setValue'"
![Oscar de la Hera Gomez](https://www.delasign.com/CDN/headshots/profile.webp)
![Three flowers that represent Swift, SwiftData and Xcode. Beneath them sits the text "Error No exact matches in call to instance method 'setValue'."](https://www.delasign.com/CDN/images/How-to-solve-22No-exact-matches-in-call-to-instance-method-setValue22.webp)
Make sure that the SwiftData variable conforms to the Codable protocol.
Problem
![A screenshot of Xcode showing how a build failed when adding a complex value to a SwiftData model.](https://www.delasign.com/CDN/images/Issue_2023-10-25-151200_vigw.webp)
When adding a complex value (i.e. a struct or enumeration) we encountered the following error:
"No exact matches in call to instance method 'setValue'"
- In expansion of macro '_PersistedProperty' here
- Candidate requires that '[complex_value]' conform to 'PersistentModel' (requirement specified as 'Value' : 'PersistentModel')
- Candidate requires that '[complex_value]' conform to 'RelationshipCollection' (requirement specified as 'Value' : 'RelationshipCollection')
Solution
![A screenshot of Xcode showing how we made the complex value conform to the Codable protocol.](https://www.delasign.com/CDN/images/Solution_2023-10-25-151238_kugb.webp)
To solve this, we followed Apple's advice and made our complex value abide to the Codable protocol.
Looking to learn more about things you can do with SwiftData, Swift or XCode ?
Consult our quick start guide or search our blog to find educational content on learning how to use SwiftData, Swift or XCode.
Any Questions?
We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.