我有一个 CKRecordType,里面装满了包含成分字符串列表的食谱。如何查询在成分列表中的任意位置包含两种成分的食谱列表?
let predicate = NSPredicate(format: "ANY ingredients == %@","egg")
这是上面查询返回的列表,注意返回的菜谱只是第一个成分是“鸡蛋”的菜谱。
Name: 1 minute breakfast sandwich
Recipe_id: 533190
Ingredients:
0: egg
1: milk
2: salt
3: pepper
4: cooking spray
5: english muffin
6: cheese
7: bacon
8: tomatoes
9: basil
10: avocado
11: red pepper flakes"
Name: caesar dressing
Recipe_id: 528367
Ingredients:
0: egg
1: egg yolk
2: white wine vinegar
3: lemon
4: juice of
5: salt
6: fresh ground black pepper
7: mustard powder
8: cayenne
9: white pepper
10: parmigiano-reggiano cheese
11: extra virgin olive oil
12: thai fish sauce
13: garlic cloves"
Name: cajun hush puppies
Recipe_id: 503126
Ingredients:
0: egg
1: buttermilk
2: green onion
3: water
4: cornmeal
5: flour
6: brown sugar
7: baking powder
8: baking soda
9: salt
10: ground red pepper
11: vegetable oil"