我是
Swift的新星.有没有办法在Realm Object中存储字符串数组?
我有一个JSON对象像:
"firstName": "John","imgName": "e9a07f7d919299c8fe89a30022151135cd63773f.jpg","lastName": "Wood","permissions": { "messages": ["test","check","available"] },
如何将消息数组存储在权限密钥中?
解决方法
你可以像:
class Messages: Object { dynamic var message = "" } class Permission: Object { let messages = List<Messages>() } class Person: Object { dynamic var firstName = "" dynamic var imgName = "" dynamic var lastName = "" var permissions : Permission = Permission() }
无论如何,我认为现在在Realm Swift Documentation有很好的记录