iOS now uses package version for models

This commit is contained in:
jahorton 2019-10-10 10:26:48 +07:00
parent cb25aeba6a
commit dcd7c1cb08

View file

@ -697,11 +697,24 @@ public class Manager: NSObject, UIGestureRecognizerDelegate {
let data = try Data(contentsOf: path, options: .mappedIfSafe)
let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
if let jsonResult = jsonResult as? [String:AnyObject] {
var version: String = "error"
if let info = jsonResult["info"] as? [String:AnyObject] {
if let versionEntry = info["version"] as? [String:AnyObject] {
if let description = versionEntry["description"] as? String {
version = description;
}
}
}
if version == "error" {
throw KMPError.invalidPackage
}
if let lexicalModels = jsonResult["lexicalModels"] as? [[String:AnyObject]] {
for k in lexicalModels {
let name = k["name"] as! String
let lexicalModelID = k["id"] as! String
let version = k["version"] as! String
//TODO: handle errors if languages do not exist
//var languageName = ""