Considering the following model:
class Person: Object {
dynamic var name = ""
let hobbies = Dictionary<String, String>()
}
I'm trying to stock in Realm an object of type [String:String]
that I got from an Alamofire request but can't since hobbies
has to to be defined through let
according to RealmSwift Documentation since it is a List<T>
/Dictionary<T,U>
kind of type.
let hobbiesToStore: [String:String]
// populate hobbiestoStore
let person = Person()
person.hobbies = hobbiesToStore
I also tried to redefine init()
but always ended up with a fatal error or else.
How can I simply copy or initialize a Dictionary in RealSwift? Am I missing something trivial here?