import Foundation
import RealmSwift
class LogData: Object{
@Persisted(primaryKey: true) var _id: ObjectId
@Persisted var date: String?
@Persisted dynamic var time: String?
convenience init(content: String){
self.init()
}
}
func addNewLog(_ time:String,_ date:String) -> LogData{
let newLog = LogData()
newLog.time = time
newLog.date = date
return newLog
}
func save() {
let newLog = self.addNewLog(selectedTime, didSelectDate)
try! realm.write{
realm.add(newLog)
}
print(newLog)
}