Why does filter/sorting not showing collectionView after changing code?

ros
docs

#1

The collectionView datasource is the Results from the local database. It works at first install. When I change the variable that has Results with filter/sort, the collectionView displays nothing on the screen. When I revert back to the original line by removing filter/sort, the cells display nothing. The data is there when I print everything out.

I’m not really sure what’s happening here. Reloading the collecitionView doesn’t do anything either.

1st install, everything works

let realm = try! Realm
var availableImages : Results<Images>?

func viewDidLoad() {
    availableImages = realm.objects(Images.self)
}

// Collectionview Delegate/Datasource

2nd install, nothing displays

let realm = try! Realm
var availableImages : Results<Images>?

func viewDidLoad() {
    availableImages = realm.objects(Images.self).filter("available = true")
}

// Collectionview Delegate/Datasource

3nd install, nothing displays

let realm = try! Realm
var availableImages : Results<Images>?

func viewDidLoad() {
    availableImages = realm.objects(Images.self)
}

// Collectionview Delegate/Datasource

#2

Can you clarify what ‘at first install’ means? What happens when you build and run your project, quit it, change the line of code and then run the project again?

What happens when you then quit it, then change the line of code back and run it again?