Search code examples
swiftrealmrealm-list

Converting Realm's List<MyType> to normal set or array


I am having realm list, which type would be:

List<MyType> ... Now, if I do something like this:

myList.map{$0} I get something like :

 LazyMapSequence<List<MyType>, MyType>

but I just want result as [MyType]

How to get a normal Swift array as a result?


Solution

  • You can just initialise an array with a sequence:

    let array = Array(myList)