swift - Sqlite.swift 缺少标签 "where"

标签 swift sqlite.swift

我正在使用 sqlite.swift 库,发现 here

下面是我用来过滤结果的代码:

.filter(mdm[assetTag] != "ipad" && location == facility && [tagArray].contains(appversion))

我在 .contains 部分收到以下错误:

Missing argument label 'where' in call.

我正在遵循自述文件,不需要在过滤器的 .contains 部分中添加 where 子句。

更新:

数组声明如下:

var tagarray = [String]()

let appversion = Expression<String>("appversion")

最佳答案

Xcode 认为您正在使用 Swift 的 contains(where:)而不是where(_:)由库定义。

enter image description here

你的变量appversion类型必须为 Expression<String> .

let appversion = Expression<String>("appversion")
let tags = ["1.0","2.0.0","3.0"]

someTable.filter(tags.contains(appversion))

关于swift - Sqlite.swift 缺少标签 "where",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45865045/

相关文章:

iOS-图表 float 到整数 YAxis

swift - 在 Xcode 8 (Swift 3) 中将 Swift 数组转换为 CFArray

ios - 如何从 PageViewController 访问 ViewController 组件

ios - 我可以将 Int64 直接转换为 Int 吗?

ios - Swift 中的 UIImagePickerController 图像

ios - 在每个 Alamofire 请求之前/之后调用一个函数

ios - 添加 Xcode 子项目 : Shouldn't all the source files get copied?

ios - Swift:从 SQLite.swift 访问 NULL 值时应用程序崩溃

swift - 使用 https ://cocoapods. org/pods/SQLite.swift 连接两个 sqlite 数据库时出现问题