I'm trying to cast or convert a dictionary in to an object but I'm not sure how to do it.
This is my class:
import Foundation
class DTOStore: NSObject {
var _Id: Int64?
var _StoreId:String?
var _Name:String?
var _Address:String?
var Id: Int64 {
get {
return _Id!
}
set (pValue) {
_Id = pValue
}
}
var StoreId:String {
get {
return _StoreId!
}
set (pValue) {
_StoreId = pValue
}
}
var Name:String {
get {
return _Name!
}
set (pValue) {
_Name = pValue
}
}
var Address:String {
get {
return _Address!
}
set (pValue) {
_Address = pValue
}
}
}
And I want to do something like this:
let vDTOStore:DTOStore = SQLiteConnectionManager.selectRowDatabase(vCommand, pNumColumns: 4) as! DTOStore
Where the result of SQLiteConnectionManager.selectRowDatabase(vCommand, pNumColumns: 4) is a [String:String] dictionary, taking in consideration that the function will be casted as lot of different objects, that is why it always return a [String:String].
But as you can guess it does not work, and I have no clue on how to do it.
Thanks for the help.
nil.