I am using SQLite.swift library.
I have several Expression
s,
let idColumn = Expression<Int>("id")
let nameColumn = Expression<String>("name")
I would like to have a dictionary host them, So, I did:
let columns: [String: Expression<AnyObject>] = [
"id": idColumn,
"name": nameColumn
]
But I get compiler error:
Cannot convert value of type 'Expression<Int>' to expected dictionary value type 'Expression<AnyObject>'
Why is this error? Why Int
type can’t be AnyObject
?
I also tried Any instead of AnyObject
:
let columns: [String: Expression<Any>] = [
"id" : idColumn,
"name": nameColumn
]
Similar error shows:
Cannot convert value of type 'Expression<Int>' to expected dictionary value type 'Expression<Any>'
I don't understand this... Could someone please explain to me?