From 9c06dd51a83ac591ddbbb0708e005e2894d6d84a Mon Sep 17 00:00:00 2001 From: Damiaan Dufaux Date: Wed, 2 Aug 2017 17:37:10 +0200 Subject: [PATCH] Add custom type to readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5a0a618..65ad97f 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,19 @@ ```swift import MsgPack +// Encode standard types let encoder = Encoder() try encoder.encode("Hello world") try encoder.encode("😇") try encoder.encode(0x0102030405060708) try encoder.encode(["Some strings", "in an array"]) + +// Encode custom types with Encodable 🎉 +struct Point: Encodable { + let x: Int + let y: Int +} +try encoder.encode(Point(x: 90, y: 45)) ``` Take a look at the [playground](Playground.playground/Contents.swift) for more examples. \ No newline at end of file