You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'd need to make your Chapter class a sub-class of SQLTable - refer to the example project to see how this works. Then you can inherit the functionality provided in SQLTable.
I have the same question. I have multiple columns and created a model class for JSON response. I wish to store all these data to SQLite using SQLTable.
For example, Here is my model class:
import SwiftyJSON
class TripData{
var avgSpeed : Int!
var createdAt : Int!
var deviceUuid : String!
var distancekm : Int!
var distractions : Int!
init(fromJson json: JSON!){
if json.isEmpty{
return
}
avgSpeed = json["avg_speed"].intValue
createdAt = json["createdAt"].intValue
deviceUuid = json["device_uuid"].stringValue
distancekm = json["distancekm"].intValue
distractions = json["distractions"].intValue
}
}
As you said, I have tried to make my TripData class a sub-class of SQLTable (class TripData : SQLTable) but it throws this warning,
'required' initializer 'init()' must be provided by subclass of 'SQLTable'
I don't understand how to use the same class as SQLTable also. Could anyone of you help me please?
Hi,
I like this wrapper it is very simple and lightweight but I am wondering about the following:
I have the follwong decodable object so how can I use SQLTable with it? or do I need to create a seperate model for SQLTable?:-
struct Chapter: Decodable {
let chapter: Int
}
Thanks
Wael
The text was updated successfully, but these errors were encountered: