3 ms·
I don't know about Swift, but in Objective-C, couldn't you use something like NSKeyedArchiver for serializing a complex object graph to a byte string? It's not
by TazeTSchnitzel 2y ago
I don't know about Swift, but in Objective-C, couldn't you use something like NSKeyedArchiver for serializing a complex object graph to a byte string? It's not safe if you don't trust the input, but if you do, I'm not sure why you'd go to the effort of reinventing this particular wheel, besides it being fun. Though maybe the serialization and deserialization are not the interesting parts here.
- Bogdanp 2y agoThat still leaves you with the problem of wiring up the request -> response types manually, doesn't it? The serialization format isn't that important in this case.
- TazeTSchnitzel 2y agoOh, I see, so the value of the DSL is in handling the pair of request and response. I suppose that makes sense. There is probably a way you could accomplish this with generically serialized objects that have virtual methods, but it wouldn't be as neat or type-safe.
- hot_gril 2y agoSwift has Codable which seems to work for this, but I haven't used it in forever.