Skip to content

vivalalova/Handy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@Codable
struct Model {
    var date: Date?
}

tobe

struct Model {
    var date: Date?

    init(date: Date? = nil) {
        self.date = date
    }

    init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        if let dateValue = try? container.decode(Date?.self, forKey: .date) {
            self.date = dateValue
        }
    }
}

extension Model: Codable {
}

About

Swift Macro Practice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages