I have a
Crashlytics.sharedInstance().setObjectValue(loginAccount, forKey: "loginAccount")

I have access to SwiftyJSON Pod in my project, so I've tried
print(JSON(loginAccount))
I got
unknown
What should I do to make my dict more humanly readable ?
import Foundation
import SwiftyJSON
public class SessionAccount : NSObject {
var id : Int?
var username : String?
var password : String?
var accountType : String?
var role : String?
var privateVlan : String?
var guestVlan : String?
var timezoneOffset : Int?
var loginTime : Date?
var cpe : CPE?
var cpeName : String?
var cpeProfiles : [Profile] = []
var deviceCount : Int?
var activeCount : Int?
var inactiveCount : Int?
var offlineCount : Int?
var profileDevices : [Device] = []
var cpeDevices : [Device] = []
var lanSetting : LANSetting?
var alerts : [Alert] = []
var quarantineList : [String] = []
override init() {
super.init()
}
convenience init(_ record: JSON) {
self.init()
self.id = record["id"].int
self.accountType = record["accountType"].string
self.role = record["role"].string
self.timezoneOffset = record["timezoneOffset"].int
}
}
You can use dump(self).
dump() doesn't return a string. It just prints out to the console,
output will be -
<SessionAccount: 0x000055957bfcd400> #0
- super: Foundation.NSObject
- id: nil
- username: nil
- password: nil
- accountType: nil
- role: nil
- privateVlan: nil
- guestVlan: nil
- timezoneOffset: nil
- loginTime: nil
- cpeName: nil
- deviceCount: nil
- activeCount: nil
- inactiveCount: nil
- offlineCount: nil
- quarantineList: 0 elements
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With