I was able to have this sort of working with this code:
newPhotos
.ignoreOutput()
.filter { [unowned self] _ in
self.images.value.count == 6
}
.sink(receiveCompletion: { [unowned self] _ in
self.alert(title: "Limit reached", text: "Buy CollagePro to make collages with more than 6 photos")
.sink(receiveCompletion: { [weak self] _ in
self?.navigationController?.popToRootViewController(animated: true)
}, receiveValue: { _ in })
.store(in: &self.subscriptions)
}, receiveValue: { _ in
})
.store(in: &self.subscriptions)
Anyway the alert shows up when the user manually pops to root view controller via navigation bar.