小编Sam*_*amm的帖子

如何在Swift中过滤对象数组?

嗨,我有一个类型为Book对象的数组,并且我试图返回按tags属性过滤的所有Books 。例如

var books = [

(title = "The Da Vinci Code", tags = "Religion, Mystery, Europe"), 
(title = "The Girl With the Dragon Tatoo", tags = "Psychology, Mystery, Thriller"), 
(title = "Freakonomics", tags = "Economics, non-fiction, Psychology")

}]
Run Code Online (Sandbox Code Playgroud)

并且我想找到与标记相关的书Psychology(title = "The Girl With the Dragon Tatoo", tag = "Psychology, Mystery, Thriller")并且(title = "Freakonomics", tags = "Economics, non-fiction, Psychology"),我该怎么做?

filter swift

2
推荐指数
1
解决办法
3795
查看次数

标签 统计

filter ×1

swift ×1