Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Update QueryEncoder.swift (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
dblythy authored and TomWFox committed Jul 26, 2019
1 parent a91cb9f commit b6888eb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/ParseLiveQuery/Internal/QueryEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
var encodedQueryDictionary: Dictionary {
var encodedQueryDictionary = Dictionary()
for (key, val) in self {
if let dict = val as? [String:AnyObject] {
if let array = val as? [PFQuery] {
var queries:[Value] = []
for query in array {
let queryState = query.value(forKey: "state") as AnyObject?
if let conditions: [String:AnyObject] = queryState?.value(forKey: "conditions") as? [String:AnyObject], let encoded = conditions.encodedQueryDictionary as? Value {
queries.append(encoded)
}
}
encodedQueryDictionary[key] = queries as? Value
}
else if let dict = val as? [String:AnyObject] {
encodedQueryDictionary[key] = dict.encodedQueryDictionary as? Value
} else if let geoPoint = val as? PFGeoPoint {
encodedQueryDictionary[key] = geoPoint.encodedDictionary as? Value
Expand Down

0 comments on commit b6888eb

Please sign in to comment.