40 lines
841 B
Swift
40 lines
841 B
Swift
//
|
|
// VAd.swift
|
|
// AutoCatCore
|
|
//
|
|
// Created by Selim Mustafaev on 02.04.2022.
|
|
//
|
|
|
|
import Foundation
|
|
import CoreData
|
|
|
|
public struct VAd: Decodable {
|
|
|
|
let id: Int64
|
|
let url: String?
|
|
let price: String?
|
|
let date: Double
|
|
let mileage: String?
|
|
let region: String?
|
|
let city: String?
|
|
let adDescription: String?
|
|
let photos: [String]
|
|
}
|
|
|
|
extension CDVAd {
|
|
|
|
convenience init(model: VAd?, context: NSManagedObjectContext) {
|
|
self.init(context: context)
|
|
|
|
self.id = model?.id ?? 0
|
|
self.url = model?.url
|
|
self.price = model?.price
|
|
self.date = model?.date ?? 0
|
|
self.mileage = model?.mileage
|
|
self.region = model?.region
|
|
self.city = model?.city
|
|
self.adDescription = model?.adDescription
|
|
self.photos = model?.photos
|
|
}
|
|
}
|