Skip to content

Commit c18388b

Browse files
committed
Implement the basics of BinaryEncoder.
1 parent 81cd565 commit c18388b

File tree

7 files changed

+401
-0
lines changed

7 files changed

+401
-0
lines changed

BinaryCodable.swift

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
public typealias BinaryCodable = BinaryEncodable & BinaryDecodable

BinaryCoder.xcodeproj/project.pbxproj

+143
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,32 @@
66
objectVersion = 48;
77
objects = {
88

9+
/* Begin PBXBuildFile section */
10+
C21B17921F21828D00286183 /* BinaryEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21B17911F21828D00286183 /* BinaryEncoder.swift */; };
11+
C21B179A1F2182DD00286183 /* BinaryEncoderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21B17991F2182DD00286183 /* BinaryEncoderTests.swift */; };
12+
C21B179C1F2182DD00286183 /* libBinaryCoder.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C21B178A1F21827F00286183 /* libBinaryCoder.dylib */; };
13+
C21B17A31F21854700286183 /* BinaryDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21B17A21F21854700286183 /* BinaryDecoder.swift */; };
14+
C21B17A51F21856000286183 /* BinaryCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21B17A41F21856000286183 /* BinaryCodable.swift */; };
15+
/* End PBXBuildFile section */
16+
17+
/* Begin PBXContainerItemProxy section */
18+
C21B179D1F2182DD00286183 /* PBXContainerItemProxy */ = {
19+
isa = PBXContainerItemProxy;
20+
containerPortal = C21B17821F21827F00286183 /* Project object */;
21+
proxyType = 1;
22+
remoteGlobalIDString = C21B17891F21827F00286183;
23+
remoteInfo = BinaryCoder;
24+
};
25+
/* End PBXContainerItemProxy section */
26+
927
/* Begin PBXFileReference section */
1028
C21B178A1F21827F00286183 /* libBinaryCoder.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libBinaryCoder.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
29+
C21B17911F21828D00286183 /* BinaryEncoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryEncoder.swift; sourceTree = "<group>"; };
30+
C21B17971F2182DD00286183 /* BinaryEncoderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BinaryEncoderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
31+
C21B17991F2182DD00286183 /* BinaryEncoderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryEncoderTests.swift; sourceTree = "<group>"; };
32+
C21B179B1F2182DD00286183 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
33+
C21B17A21F21854700286183 /* BinaryDecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryDecoder.swift; sourceTree = "<group>"; };
34+
C21B17A41F21856000286183 /* BinaryCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryCodable.swift; sourceTree = "<group>"; };
1135
/* End PBXFileReference section */
1236

1337
/* Begin PBXFrameworksBuildPhase section */
@@ -18,12 +42,24 @@
1842
);
1943
runOnlyForDeploymentPostprocessing = 0;
2044
};
45+
C21B17941F2182DD00286183 /* Frameworks */ = {
46+
isa = PBXFrameworksBuildPhase;
47+
buildActionMask = 2147483647;
48+
files = (
49+
C21B179C1F2182DD00286183 /* libBinaryCoder.dylib in Frameworks */,
50+
);
51+
runOnlyForDeploymentPostprocessing = 0;
52+
};
2153
/* End PBXFrameworksBuildPhase section */
2254

2355
/* Begin PBXGroup section */
2456
C21B17811F21827F00286183 = {
2557
isa = PBXGroup;
2658
children = (
59+
C21B17A41F21856000286183 /* BinaryCodable.swift */,
60+
C21B17A21F21854700286183 /* BinaryDecoder.swift */,
61+
C21B17911F21828D00286183 /* BinaryEncoder.swift */,
62+
C21B17981F2182DD00286183 /* BinaryEncoderTests */,
2763
C21B178B1F21827F00286183 /* Products */,
2864
);
2965
sourceTree = "<group>";
@@ -32,10 +68,20 @@
3268
isa = PBXGroup;
3369
children = (
3470
C21B178A1F21827F00286183 /* libBinaryCoder.dylib */,
71+
C21B17971F2182DD00286183 /* BinaryEncoderTests.xctest */,
3572
);
3673
name = Products;
3774
sourceTree = "<group>";
3875
};
76+
C21B17981F2182DD00286183 /* BinaryEncoderTests */ = {
77+
isa = PBXGroup;
78+
children = (
79+
C21B17991F2182DD00286183 /* BinaryEncoderTests.swift */,
80+
C21B179B1F2182DD00286183 /* Info.plist */,
81+
);
82+
path = BinaryEncoderTests;
83+
sourceTree = "<group>";
84+
};
3985
/* End PBXGroup section */
4086

4187
/* Begin PBXHeadersBuildPhase section */
@@ -66,17 +112,40 @@
66112
productReference = C21B178A1F21827F00286183 /* libBinaryCoder.dylib */;
67113
productType = "com.apple.product-type.library.dynamic";
68114
};
115+
C21B17961F2182DD00286183 /* BinaryEncoderTests */ = {
116+
isa = PBXNativeTarget;
117+
buildConfigurationList = C21B179F1F2182DD00286183 /* Build configuration list for PBXNativeTarget "BinaryEncoderTests" */;
118+
buildPhases = (
119+
C21B17931F2182DD00286183 /* Sources */,
120+
C21B17941F2182DD00286183 /* Frameworks */,
121+
C21B17951F2182DD00286183 /* Resources */,
122+
);
123+
buildRules = (
124+
);
125+
dependencies = (
126+
C21B179E1F2182DD00286183 /* PBXTargetDependency */,
127+
);
128+
name = BinaryEncoderTests;
129+
productName = BinaryEncoderTests;
130+
productReference = C21B17971F2182DD00286183 /* BinaryEncoderTests.xctest */;
131+
productType = "com.apple.product-type.bundle.unit-test";
132+
};
69133
/* End PBXNativeTarget section */
70134

71135
/* Begin PBXProject section */
72136
C21B17821F21827F00286183 /* Project object */ = {
73137
isa = PBXProject;
74138
attributes = {
139+
LastSwiftUpdateCheck = 0900;
75140
LastUpgradeCheck = 0900;
76141
ORGANIZATIONNAME = mikeash;
77142
TargetAttributes = {
78143
C21B17891F21827F00286183 = {
79144
CreatedOnToolsVersion = 9.0;
145+
LastSwiftMigration = 0900;
146+
};
147+
C21B17961F2182DD00286183 = {
148+
CreatedOnToolsVersion = 9.0;
80149
};
81150
};
82151
};
@@ -93,20 +162,50 @@
93162
projectRoot = "";
94163
targets = (
95164
C21B17891F21827F00286183 /* BinaryCoder */,
165+
C21B17961F2182DD00286183 /* BinaryEncoderTests */,
96166
);
97167
};
98168
/* End PBXProject section */
99169

170+
/* Begin PBXResourcesBuildPhase section */
171+
C21B17951F2182DD00286183 /* Resources */ = {
172+
isa = PBXResourcesBuildPhase;
173+
buildActionMask = 2147483647;
174+
files = (
175+
);
176+
runOnlyForDeploymentPostprocessing = 0;
177+
};
178+
/* End PBXResourcesBuildPhase section */
179+
100180
/* Begin PBXSourcesBuildPhase section */
101181
C21B17861F21827F00286183 /* Sources */ = {
102182
isa = PBXSourcesBuildPhase;
103183
buildActionMask = 2147483647;
104184
files = (
185+
C21B17921F21828D00286183 /* BinaryEncoder.swift in Sources */,
186+
C21B17A51F21856000286183 /* BinaryCodable.swift in Sources */,
187+
C21B17A31F21854700286183 /* BinaryDecoder.swift in Sources */,
188+
);
189+
runOnlyForDeploymentPostprocessing = 0;
190+
};
191+
C21B17931F2182DD00286183 /* Sources */ = {
192+
isa = PBXSourcesBuildPhase;
193+
buildActionMask = 2147483647;
194+
files = (
195+
C21B179A1F2182DD00286183 /* BinaryEncoderTests.swift in Sources */,
105196
);
106197
runOnlyForDeploymentPostprocessing = 0;
107198
};
108199
/* End PBXSourcesBuildPhase section */
109200

201+
/* Begin PBXTargetDependency section */
202+
C21B179E1F2182DD00286183 /* PBXTargetDependency */ = {
203+
isa = PBXTargetDependency;
204+
target = C21B17891F21827F00286183 /* BinaryCoder */;
205+
targetProxy = C21B179D1F2182DD00286183 /* PBXContainerItemProxy */;
206+
};
207+
/* End PBXTargetDependency section */
208+
110209
/* Begin XCBuildConfiguration section */
111210
C21B178C1F21827F00286183 /* Debug */ = {
112211
isa = XCBuildConfiguration;
@@ -214,22 +313,58 @@
214313
C21B178F1F21827F00286183 /* Debug */ = {
215314
isa = XCBuildConfiguration;
216315
buildSettings = {
316+
CLANG_ENABLE_MODULES = YES;
217317
DEVELOPMENT_TEAM = 44N4WJ59X4;
218318
DYLIB_COMPATIBILITY_VERSION = 1;
219319
DYLIB_CURRENT_VERSION = 1;
220320
EXECUTABLE_PREFIX = lib;
321+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
221322
PRODUCT_NAME = "$(TARGET_NAME)";
323+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
324+
SWIFT_VERSION = 3.0;
222325
};
223326
name = Debug;
224327
};
225328
C21B17901F21827F00286183 /* Release */ = {
226329
isa = XCBuildConfiguration;
227330
buildSettings = {
331+
CLANG_ENABLE_MODULES = YES;
228332
DEVELOPMENT_TEAM = 44N4WJ59X4;
229333
DYLIB_COMPATIBILITY_VERSION = 1;
230334
DYLIB_CURRENT_VERSION = 1;
231335
EXECUTABLE_PREFIX = lib;
336+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
232337
PRODUCT_NAME = "$(TARGET_NAME)";
338+
SWIFT_VERSION = 3.0;
339+
};
340+
name = Release;
341+
};
342+
C21B17A01F2182DD00286183 /* Debug */ = {
343+
isa = XCBuildConfiguration;
344+
buildSettings = {
345+
COMBINE_HIDPI_IMAGES = YES;
346+
DEVELOPMENT_TEAM = 44N4WJ59X4;
347+
INFOPLIST_FILE = BinaryEncoderTests/Info.plist;
348+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
349+
PRODUCT_BUNDLE_IDENTIFIER = com.mikeash.BinaryEncoderTests;
350+
PRODUCT_NAME = "$(TARGET_NAME)";
351+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
352+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
353+
SWIFT_VERSION = 4.0;
354+
};
355+
name = Debug;
356+
};
357+
C21B17A11F2182DD00286183 /* Release */ = {
358+
isa = XCBuildConfiguration;
359+
buildSettings = {
360+
COMBINE_HIDPI_IMAGES = YES;
361+
DEVELOPMENT_TEAM = 44N4WJ59X4;
362+
INFOPLIST_FILE = BinaryEncoderTests/Info.plist;
363+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
364+
PRODUCT_BUNDLE_IDENTIFIER = com.mikeash.BinaryEncoderTests;
365+
PRODUCT_NAME = "$(TARGET_NAME)";
366+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
367+
SWIFT_VERSION = 4.0;
233368
};
234369
name = Release;
235370
};
@@ -253,6 +388,14 @@
253388
);
254389
defaultConfigurationIsVisible = 0;
255390
};
391+
C21B179F1F2182DD00286183 /* Build configuration list for PBXNativeTarget "BinaryEncoderTests" */ = {
392+
isa = XCConfigurationList;
393+
buildConfigurations = (
394+
C21B17A01F2182DD00286183 /* Debug */,
395+
C21B17A11F2182DD00286183 /* Release */,
396+
);
397+
defaultConfigurationIsVisible = 0;
398+
};
256399
/* End XCConfigurationList section */
257400
};
258401
rootObject = C21B17821F21827F00286183 /* Project object */;

BinaryCoder.xcodeproj/xcuserdata/mikeash.xcuserdatad/xcschemes/xcschememanagement.plist

+18
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@
99
<key>orderHint</key>
1010
<integer>0</integer>
1111
</dict>
12+
<key>BinaryEncoderTests.xcscheme</key>
13+
<dict>
14+
<key>orderHint</key>
15+
<integer>1</integer>
16+
</dict>
17+
</dict>
18+
<key>SuppressBuildableAutocreation</key>
19+
<dict>
20+
<key>C21B17891F21827F00286183</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
<key>C21B17961F2182DD00286183</key>
26+
<dict>
27+
<key>primary</key>
28+
<true/>
29+
</dict>
1230
</dict>
1331
</dict>
1432
</plist>

BinaryDecoder.swift

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
public protocol BinaryDecodable: Decodable {
3+
4+
}

0 commit comments

Comments
 (0)