简体   繁体   English

如何将[Double]数组保存到Realm?

[英]How can I save [Double] array into Realm?

I need to save array of Double's into the Realm. 我需要将Double数组保存到Realm中。 But It seems to be unsupported. 但这似乎不受支持。

dynamic var doubleArray = [Double]()  // error
let doubleArray2 = List<Double>()     // error

NSMutableArray seems to be unsupported too. NSMutableArray似乎也不受支持。 I tried find solution in documentation and API but unsuccessfully. 我尝试在文档和API中找到解决方案,但未成功。 Thanks 谢谢

Only lists of Realm Objects can be used inside a parent Realm Object. 父领域对象内只能使用领域对象列表。

The easiest way to get around this would be to create another Realm Object subclass that has a Double property, and then use multiple instances of those to be saved in the parent List property. 解决此问题的最简单方法是创建另一个具有Double属性的Realm Object子类,然后使用要保存在父级List属性中的多个实例。

Hope that helped! 希望能有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM