Search code examples
swiftuirealm

Realm with SwiftUI Returning List<ShoppingItem>


I am using Realm with SwiftUI and creating a parent-child relationship. I am creating the following property so it can return List. The reason, I am creating a property is because I want to perform filter and sort on it, which I will do later.

 var items: List<ShoppingItem> {
        shoppingList.items
    }

I get a weird error message:

enter image description here


Solution

  • It conflicts with SwiftUI.List, so you need to add module explicitly

    var items: RealmSwift.List<ShoppingItem>