Brian
Brian

Reputation: 733

Query List of Strings in Realm

I am working with Realm Swift and I am running into an issue where I need to write a query that filters Realm objects by both a boolean property and a List on a Realm object.

The Realm objects I would like to filter have a List value and it contains an array of strings. The values in this List will only ever be one of the following possibilities: "US", "CA", or "US" and "CA".

How might I go about writing an appropriate predicate to filter by both a boolean and one of the values contained in the List property? So far I have tried this type of query with no success:

category.templates.filter("testMode = false AND countries CONTAINS 'US')

Upvotes: 1

Views: 1822

Answers (1)

Brian
Brian

Reputation: 733

UPDATE: After doing some more digging around I found that this solution actually solved what I was attempting to do with Realm: Swift Realm filter List property using an Array

Upvotes: 1

Related Questions