'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 1:[1]

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

var items: RealmSwift.List<ShoppingItem>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Asperi