Skip to content

Commit 3a38a02

Browse files
committed
Merge branch 'release-candidate' into stable
2 parents d15268c + 1c83ad7 commit 3a38a02

23 files changed

+971
-97
lines changed

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.2

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ branches:
88

99
matrix:
1010
include:
11-
- name: "OS X Xcode 10.1"
11+
- name: "OS X / Xcode 10.1"
1212
os: osx
1313
osx_image: xcode10.1
1414
language: swift
1515
script:
1616
- swift test
1717

18-
- name: "Linux Swift 4.2.2"
18+
- name: "Ubuntu 16.04 / Swift 4.2.2"
1919
os: linux
2020
dist: xenial
2121
language: c
@@ -27,7 +27,7 @@ matrix:
2727
script:
2828
- swift test
2929

30-
- name: "Linux Swift latest"
30+
- name: "Ubuntu 16.04 / Swift latest"
3131
os: linux
3232
dist: xenial
3333
language: c

BinaryCodable.podspec

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'BinaryCodable'
3+
s.version = '0.1.0'
4+
s.license = 'Apache 2.0'
5+
s.summary = 'Codable-like interfaces for binary representations.'
6+
s.homepage = 'https://github.com/jverkoey/BinaryCodable'
7+
s.authors = { 'BinaryCodable authors' => '[email protected]' }
8+
s.source = { :git => 'https://github.com/jverkoey/BinaryCodable.git', :tag => s.version }
9+
s.documentation_url = 'https://github.com/jverkoey/BinaryCodable/'
10+
11+
s.ios.deployment_target = '12.0'
12+
s.osx.deployment_target = '10.12'
13+
14+
s.source_files = ['Sources/*.swift', 'Sources/*/*.swift']
15+
end

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 0.1.0
2+
3+
This is the first minor, unstable release of BinaryCodable. The public API for this library is subject to change unexpectedly until 1.0.0 is reached, at which point breaking changes will be mitigated and communicated ahead of time. This initial release includes the following features:
4+
5+
- Encode from Swift types to `Data`.
6+
- Decode from `Data` to Swift types.
7+
- Efficiently encode/decode large blocks of arbitrary data.
8+
- Lazy decoding (read bytes from a source only as they're needed).
9+
- Encode and decode fixed-width integer types.
10+
- Encode and decode strings with or without terminators.
11+
- Cap decoding containers to a maximum length.

Docs/ComparisonToSwiftCodable.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Comparison to Swift Codable
2+
3+
Binary Codable is similar to Swift [Codable](https://developer.apple.com/documentation/foundation/archives_and_serialization) in that both define an encodable and decodable type that concrete types are expected to implement and both provide encoders and decoders.
4+
5+
Binary Codable is distinct from Swift Codable in the assumptions it makes about how external representations are structured. Swift Codable assumes that external representations have a pre-determined structure (JSON, PropertyList, etc...). Binary Codable, on the other hand, views external representations purely as binary data. This distinction is reflected in the difference of the APIs provided by the BinaryEncoder and BinaryCoder types.
6+
7+
## Interface comparison
8+
9+
Swift Codable and Binary Codable's related types are outlined below.
10+
11+
| Swift Codable | Binary Codable |
12+
|:--------------|:------------------|
13+
| `Codable` | `BinaryCodable` |
14+
| `Encodable` | `BinaryEncodable` |
15+
| `Decodable` | `BinaryDecodable` |
16+
17+
| Swift Codable Encoder | Binary Codable Encoder |
18+
|:-------------------------------|:------------------------------------|
19+
| `KeyedEncodingContainer` | No equivalent |
20+
| `UnkeyedEncodingContainer` | `SequentialBinaryEncodingContainer` |
21+
| `SingleValueEncodingContainer` | No equivalent |
22+
23+
| Swift Codable Encoding Container | Binary Codable Encoding Container |
24+
|:---------------------------------|:--------------------------------------------------------------------------|
25+
| `encode(_ value: Int8)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
26+
| `encode(_ value: Int16)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
27+
| `encode(_ value: Int32)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
28+
| `encode(_ value: Int64)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
29+
| `encode(_ value: UInt8)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
30+
| `encode(_ value: UInt16)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
31+
| `encode(_ value: UInt32)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
32+
| `encode(_ value: UInt64)` | `encode<T>(_ value: T) where T: FixedWidthInteger` |
33+
| `encode<T>(_ value: T)` | `encode<T>(_ value: T)` |
34+
| `encode(_ value: String)` | `encode(_ value: String, encoding: String.Encoding, terminator: UInt8?)` |
35+
| No equivalent | `encode<S>(sequence: S) throws where S: Sequence, S.Element == UInt8` |
36+
37+
| Swift Codable Decoder | Binary Codable Decoder |
38+
|:-------------------------------|:------------------------------------|
39+
| `KeyedDecodingContainer` | No equivalent |
40+
| `UnkeyedDecodingContainer` | `SequentialBinaryDecodingContainer` |
41+
| `SingleValueDecodingContainer` | No equivalent |
42+
43+
| Swift Codable Decoding Container | Binary Codable Decoding Container |
44+
|:------------------------------------------------|:------------------------------------------------------------------------|
45+
| `decode(_ type: Int8.Type) -> Int8` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
46+
| `decode(_ type: Int16.Type) -> Int16` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
47+
| `decode(_ type: Int32.Type) -> Int32` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
48+
| `decode(_ type: Int64.Type) -> Int64` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
49+
| `decode(_ type: UInt8.Type) -> UInt8` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
50+
| `decode(_ type: UInt16.Type) -> UInt16` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
51+
| `decode(_ type: UInt32.Type) -> UInt32` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
52+
| `decode(_ type: UInt64.Type) -> UInt64` | `decode<T>(_ type: T.Type) -> T where T: FixedWidthInteger` |
53+
| `decode<T>(_ type: T.Type) where T : Decodable` | `decode<T>(_ type: T.Type) -> T where T: BinaryDecodable` |
54+
| `decode(_ type: String.Type) -> String` | `decodeString(encoding: String.Encoding, terminator: UInt8?) -> String` |
55+
| No equivalent | `decode(length: Int) -> Data` |
56+
| No equivalent | `peek(length: Int) -> Data` |

0 commit comments

Comments
 (0)