Skip to content

Commit

Permalink
Merge pull request #16 from PersistX/swift-5
Browse files Browse the repository at this point in the history
Swift 5
  • Loading branch information
mdiep authored Mar 31, 2019
2 parents aa965cb + a0be53c commit 43066de
Show file tree
Hide file tree
Showing 25 changed files with 69 additions and 320 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Carthage/Checkouts/Result"]
path = Carthage/Checkouts/Result
url = https://github.com/antitypical/Result.git
[submodule "Carthage/Checkouts/Standards"]
path = Carthage/Checkouts/Standards
url = https://github.com/PersistX/Standards.git
22 changes: 13 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
aliases:
- &xcode
language: objective-c
script: script/cibuild "$TRAVIS_XCODE_WORKSPACE" "$TRAVIS_XCODE_SCHEME" "build-for-testing test-without-building"
xcode_workspace: Schemata.xcworkspace
- &xcode10
script: script/cibuild "$TRAVIS_XCODE_PROJECT" "$TRAVIS_XCODE_SCHEME" "build-for-testing test-without-building"
xcode_project: Schemata.xcodeproj
- &xcode10_2
<<: *xcode
osx_image: xcode10
osx_image: xcode10.2
- &macOS
xcode_scheme: Schemata (macOS)
- &iOS
xcode_scheme: Schemata (iOS)

os: osx

before_install:
- brew install swiftformat
- brew install swiftlint
Expand All @@ -23,13 +23,17 @@ branches:

matrix:
include:
- <<: *xcode10
- <<: *xcode10_2
<<: *macOS
- <<: *xcode10
name: macOS
- <<: *xcode10_2
<<: *iOS
- <<: *xcode10
name: iOS
- <<: *xcode10_2
name: SwiftPM
script: swift test
- <<: *xcode10
- <<: *xcode10_2
name: Standards
script: ./Carthage/Checkouts/Standards/test

notifications:
Expand Down
1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

3 changes: 1 addition & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github "PersistX/Standards" "ea78af155f7416efea5841b013576d77e26d3050"
github "antitypical/Result" "4.0.0"
github "PersistX/Standards" "89c30330fcac972a84a4876125064001b9c89f0f"
1 change: 0 additions & 1 deletion Carthage/Checkouts/Result
Submodule Result deleted from 8fc088
16 changes: 0 additions & 16 deletions Package.resolved

This file was deleted.

4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:5.0

import PackageDescription

Expand All @@ -11,13 +11,11 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/antitypical/Result.git", from: "4.0.0"),
],
targets: [
.target(
name: "Schemata",
dependencies: [
"Result",
],
path: "Sources"
),
Expand Down
38 changes: 4 additions & 34 deletions Schemata.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
BE64E7241EA3AF4D0047D035 /* Schemata.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE64E71A1EA3AF4D0047D035 /* Schemata.framework */; };
BE64E72B1EA3AF4D0047D035 /* Schemata.h in Headers */ = {isa = PBXBuildFile; fileRef = BE64E71D1EA3AF4D0047D035 /* Schemata.h */; settings = {ATTRIBUTES = (Public, ); }; };
BE64E7351EA3B23B0047D035 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE64E7341EA3B23B0047D035 /* Schema.swift */; };
BE64E7501EA3B4660047D035 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE64E74F1EA3B4660047D035 /* Result.framework */; };
BE64E7781EA3F3110047D035 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE64E7761EA3F3110047D035 /* Result.framework */; };
BE80D7142113D8C700822B6C /* Initializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE80D7132113D8C700822B6C /* Initializer.swift */; };
BE80D71521140DF400822B6C /* Initializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE80D7132113D8C700822B6C /* Initializer.swift */; };
BEBC36D2200F9606000E3AAB /* None.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEBC36D1200F9606000E3AAB /* None.swift */; };
Expand All @@ -39,8 +37,6 @@
BEDE906220150856004656FC /* ModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE52A5A31F1D29090017B369 /* ModelTests.swift */; };
BEDE906320150856004656FC /* ProjectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE101C6A1F535B3500FEB1A4 /* ProjectionTests.swift */; };
BEDE906420150856004656FC /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEFD30B71EDB51C0004FF8FB /* SchemaTests.swift */; };
BEDE90652015086E004656FC /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEDE90662015086E004656FC /* Result.framework */; };
BEDE9069201508B9004656FC /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEDE906A201508B9004656FC /* Result.framework */; };
BEE9FD751EC282D20081AD1E /* DecodeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEE9FD741EC282D20081AD1E /* DecodeError.swift */; };
BEFD30B91EDB52CD004FF8FB /* SchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEFD30B71EDB51C0004FF8FB /* SchemaTests.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -76,16 +72,12 @@
BE64E7231EA3AF4D0047D035 /* SchemataTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SchemataTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BE64E72A1EA3AF4D0047D035 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BE64E7341EA3B23B0047D035 /* Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Schema.swift; sourceTree = "<group>"; };
BE64E74F1EA3B4660047D035 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Checkouts/Result/build/Debug/Result.framework; sourceTree = "<group>"; };
BE64E7761EA3F3110047D035 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../../Library/Developer/Xcode/DerivedData/Schemata-fleiyfwzrgbgvscfywvtqflpyevd/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; };
BE80D7132113D8C700822B6C /* Initializer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Initializer.swift; sourceTree = "<group>"; };
BEBC36D1200F9606000E3AAB /* None.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = None.swift; sourceTree = "<group>"; };
BECF338E1EE9BCAC00F9FC88 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
BECF33901EEA2EE400F9FC88 /* Primitive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Primitive.swift; sourceTree = "<group>"; };
BEDE9040201507E1004656FC /* Schemata.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Schemata.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BEDE9048201507E2004656FC /* SchemataTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SchemataTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BEDE90662015086E004656FC /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BEDE906A201508B9004656FC /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BEE9FD741EC282D20081AD1E /* DecodeError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecodeError.swift; sourceTree = "<group>"; };
BEFD30B71EDB51C0004FF8FB /* SchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -95,15 +87,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE64E7501EA3B4660047D035 /* Result.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BE64E7201EA3AF4D0047D035 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE64E7781EA3F3110047D035 /* Result.framework in Frameworks */,
BE64E7241EA3AF4D0047D035 /* Schemata.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -112,15 +102,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BEDE90652015086E004656FC /* Result.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BEDE9045201507E1004656FC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BEDE9069201508B9004656FC /* Result.framework in Frameworks */,
BEDE9049201507E2004656FC /* Schemata.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -134,7 +122,6 @@
BE64E71C1EA3AF4D0047D035 /* Sources */,
BE64E7271EA3AF4D0047D035 /* Tests */,
BE64E71B1EA3AF4D0047D035 /* Products */,
BE64E74E1EA3B4660047D035 /* Frameworks */,
);
sourceTree = "<group>";
usesTabs = 0;
Expand Down Expand Up @@ -181,17 +168,6 @@
path = Tests;
sourceTree = "<group>";
};
BE64E74E1EA3B4660047D035 /* Frameworks */ = {
isa = PBXGroup;
children = (
BEDE906A201508B9004656FC /* Result.framework */,
BEDE90662015086E004656FC /* Result.framework */,
BE64E7761EA3F3110047D035 /* Result.framework */,
BE64E74F1EA3B4660047D035 /* Result.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -293,7 +269,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = PersistX;
TargetAttributes = {
BE64E7191EA3AF4D0047D035 = {
Expand All @@ -318,7 +294,7 @@
};
buildConfigurationList = BE64E7141EA3AF4D0047D035 /* Build configuration list for PBXProject "Schemata" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -496,6 +472,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -549,6 +526,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -572,7 +550,6 @@
PRODUCT_NAME = Schemata;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -593,7 +570,6 @@
PRODUCT_BUNDLE_IDENTIFIER = org.persistx.Schemata;
PRODUCT_NAME = Schemata;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -606,7 +582,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.persistx.SchemataTests;
PRODUCT_NAME = SchemataTests;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -619,7 +594,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.persistx.SchemataTests;
PRODUCT_NAME = SchemataTests;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -643,7 +617,6 @@
PRODUCT_NAME = Schemata;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -668,7 +641,6 @@
PRODUCT_NAME = Schemata;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -689,7 +661,6 @@
PRODUCT_BUNDLE_IDENTIFIER = org.persistx.SchemataTests;
PRODUCT_NAME = SchemataTests;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -709,7 +680,6 @@
PRODUCT_BUNDLE_IDENTIFIER = org.persistx.SchemataTests;
PRODUCT_NAME = SchemataTests;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
10 changes: 0 additions & 10 deletions Schemata.xcworkspace/contents.xcworkspacedata

This file was deleted.

This file was deleted.

26 changes: 2 additions & 24 deletions Sources/DecodeError.swift
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
import Foundation

public enum ValueError: Swift.Error {
public enum ValueError: Swift.Error, Hashable {
case typeMismatch
}

extension ValueError: Hashable {
public var hashValue: Int {
return 0
}

public static func == (_: ValueError, _: ValueError) -> Bool {
return false
}
}

public struct DecodeError: Error {
public struct DecodeError: Error, Hashable {
public var errors: [String: ValueError]

public init(_ errors: [String: ValueError]) {
self.errors = errors
}
}

extension DecodeError: Hashable {
public var hashValue: Int {
return errors
.map { $0.key.hashValue ^ $0.value.hashValue }
.reduce(0, ^)
}

public static func == (lhs: DecodeError, rhs: DecodeError) -> Bool {
return lhs.errors == rhs.errors
}
}

extension DecodeError {
internal static func + (lhs: DecodeError, rhs: DecodeError) -> DecodeError {
var errors = lhs.errors
Expand Down
Loading

0 comments on commit 43066de

Please sign in to comment.