是否可以通过消息的文本查询LayerKit LYRMessage?

时间:2017-04-03 16:51:06

标签: swift layerkit

我想添加通过消息文本内容在LayerKit中搜索对话/消息的功能。这可能吗?我假设我需要以某种方式查询LYRMessage的LYRMessagePart,但我没有运气。

这样的事情似乎应该是可行的:

let messageTextQuery = LYRQuery(queryableClass: LYRMessage.self)
messageTextQuery.predicate = LYRPredicate(property: "parts.text", predicateOperator: LYRPredicateOperator.like, value: "%%\(searchText)%%")
messageTextQuery.sortDescriptors = [NSSortDescriptor(key: "position", ascending: false)]

layerClient.execute(messageTextQuery) { results, error in
    if let results = results {
        // do stuff with results
    }
}

0 个答案:

没有答案