3 ms·
The Codable protocol in Swift is game-changing. Max Howell (homebrew author) recently started a series of articles[1] in which he used Codable structs as the sh
by oflannabhra 8y ago
The Codable protocol in Swift is game-changing. Max Howell (homebrew author) recently started a series of articles[1] in which he used Codable structs as the shared data model in both the backend and frontend of his new app Canopy. Even though communication is through HTTP and JSON, he never even has to touch it.
[1] - https://medium.com/@mxcl/server-side-swift-making-canopy-2ed586b7f5a9 https://medium.com/@mxcl/server-side-swift-making-canopy-2ed...
- mpweiher 8y ago> Codable protocol in Swift is game-changing Which is really weird, considering Objective-C had automatic "activation/passivation" from the beginning (early 80s), and it was pretty trivial to adapt similar mechanisms later.
- maxdesiatov 8y agoExcept that in Objective-C it's a runtime feature, which is by definition slower. Swift's Codable implementation is generated by the compiler or is hand-written with an obvious benefit of a stronger type system.
- mpweiher 8y agoHave you measured this? (I have)
- aaaaaaaaaab 8y agoData model != request/response structs It’s a very bad idea to intermingle the two.