Releases: typelift/Alchemy
Releases · typelift/Alchemy
Swift Up
Alchemy Domine
Alchemy is a simple declarative binary serialization and deserialization framework for Swift values. Serialization of aggregates is quick and easy to reason about. For example:
import Alchemy
struct Foo {
let x : Int
let y : UInt
let z : Float
let s : String
}
extension Foo : Serializable {
static func deserialize<R>() -> Get<Foo, R> {
return Get.zip(
Int.deserialize(),
UInt.deserialize(),
Float.deserialize(),
String.deserialize()
).map(Foo.init)
}
var serialize : Put {
return self.x.serialize
.then(self.y.serialize)
.then(self.z.serialize)
.then(self.s.serialize)
}
}