# Friday Q&A 2017-07-28: A Binary Coder for Swift

DevFeed: [Friday Q&A 2017-07-28: A Binary Coder for Swift](<https://devfeed.tech/articles/friday-q-a-2017-07-28-a-binary-coder-for-swift-30619.md>)

Original publisher: [Read original article](<http://www.mikeash.com/pyblog/friday-qa-2017-07-28-a-binary-coder-for-swift.html>)

Author: Mike Ash

Published: 2017-07-28T12:44:00Z

Content type: tutorial

Language: en

Sources: [Mike Ash](<https://devfeed.tech/sources/mike-ash.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Protocol (disambiguation)](<https://devfeed.tech/topics/protocol.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [coding](<https://devfeed.tech/tags/coding.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [swift](<https://devfeed.tech/tags/swift.md>)

## AI overview

This article presents a custom binary coder for Swift. It serializes fields sequentially as raw bytes without metadata, omits padding, byte-swaps numbers for endian independence, and can handle references and custom encoding. The approach relies on consistent encoding and decoding order, so changes to field layout or types can break compatibility.

## Source excerpt

In my last article I discussed the basics of Swift's new Codable protocol, briefly discussed how to implement your own encoder and decoder, and promised another article about a custom binary coder I've been working on. Today, I'm going to present that binary coder. (Read More)