diff --git a/.swift-version b/.swift-version
index 7d5c902..bf77d54 100644
--- a/.swift-version
+++ b/.swift-version
@@ -1 +1 @@
-4.1
+4.2
diff --git a/.travis.yml b/.travis.yml
index ee94a6c..14290ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,27 +1,26 @@
+branches:
+  only:
+    - master
+
 env:
   global:
     - LC_CTYPE=en_US.UTF-8
 matrix:
   include:
-    - os: osx
+    - &cocoapods
+      os: osx
       language: objective-c
-      osx_image: xcode9.4
+      osx_image: xcode10.1
       script:
+        - gem update cocoapods
         # To work around the lint error: "ERROR | swift: Specification `Himotoki` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec."
         # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested.
         - rm .swift-version
         - pod lib lint
       env:
         - JOB=PODSPEC
-    - os: osx
-      language: objective-c
-      osx_image: xcode9.4
-      script:
-        - rake "build[build-for-testing test-without-building, Himotoki-macOS, macosx, arch=x86_64]"
-        - rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 8]"
-        - rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV]"
-        - rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]"
-    - os: osx
+    - &xcode
+      os: osx
       language: objective-c
       osx_image: xcode10.1
       script:
@@ -29,28 +28,22 @@ matrix:
         - rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 8]"
         - rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV]"
         - rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]"
-    - os: osx
-      language: generic
-      osx_image: xcode9.4
-      script:
-        - swift --version
-        - swift build
-        - swift test
-      env:
-        - JOB=SWIFTPM_DARWIN
-    - os: osx
+    - <<: *xcode
+      osx_image: xcode10.2
+    - &swiftpm_darwin
+      os: osx
       language: generic
       osx_image: xcode10.1
-      before_install:
-        - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
       script:
         - swift --version
         - swift build
         - swift test
       env:
         - JOB=SWIFTPM_DARWIN
-        - SWIFT_VERSION=4.2.1
-    - os: linux
+    - <<: *swiftpm_darwin
+      osx_image: xcode10.2
+    - &swiftpm_linux
+      os: linux
       language: generic
       sudo: required
       dist: trusty
@@ -62,18 +55,10 @@ matrix:
         - swift test
       env:
         - JOB=SWIFTPM_LINUX
-    - os: linux
-      language: generic
-      sudo: required
-      dist: trusty
-      before_install:
-        - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
-      script:
-        - swift --version
-        - swift build
-        - swift test
+        - SWIFT_VERSION=4.2.4
+    - <<: *swiftpm_linux
       env:
         - JOB=SWIFTPM_LINUX
-        - SWIFT_VERSION=4.2.1
+        - SWIFT_VERSION=5.0
 notifications:
   email: false
diff --git a/Himotoki.podspec b/Himotoki.podspec
index 973f17e..59c896f 100644
--- a/Himotoki.podspec
+++ b/Himotoki.podspec
@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name         = "Himotoki"
-  s.version      = "3.2.0"
+  s.version      = "4.0.0"
   s.summary      = "A type-safe JSON decoding library purely written in Swift"
   s.description  = <<-DESC
 Himotoki (紐解き) is a type-safe JSON decoding library purely written in Swift. This library is highly inspired by popular JSON parsing libraries in Swift: [Argo](https://github.com/thoughtbot/Argo) and [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper).
@@ -25,6 +25,6 @@ DESC
   s.source_files  = "Sources/**/*.swift"
   s.requires_arc = true
   
-  s.swift_version = "4.0"
   s.cocoapods_version = ">= 1.4.0"
+  s.swift_version = "4.2"
 end
diff --git a/Himotoki.xcodeproj/project.pbxproj b/Himotoki.xcodeproj/project.pbxproj
index 4c047ad..16e1915 100644
--- a/Himotoki.xcodeproj/project.pbxproj
+++ b/Himotoki.xcodeproj/project.pbxproj
@@ -562,7 +562,7 @@
 			isa = PBXProject;
 			attributes = {
 				LastSwiftUpdateCheck = 0710;
-				LastUpgradeCheck = 0930;
+				LastUpgradeCheck = 1020;
 				ORGANIZATIONNAME = "Syo Ikeda";
 				TargetAttributes = {
 					CD8F0DC61B6D014B0021196A = {
@@ -588,21 +588,22 @@
 					};
 					CDF03E321AF606F60041C3AA = {
 						CreatedOnToolsVersion = 6.3;
-						LastSwiftMigration = 0800;
+						LastSwiftMigration = 1020;
 						ProvisioningStyle = Manual;
 					};
 					CDF03E3C1AF606F60041C3AA = {
 						CreatedOnToolsVersion = 6.3;
-						LastSwiftMigration = 0800;
+						LastSwiftMigration = 1020;
 					};
 				};
 			};
 			buildConfigurationList = CD929A311AF4A2C3002F5C53 /* Build configuration list for PBXProject "Himotoki" */;
 			compatibilityVersion = "Xcode 3.2";
-			developmentRegion = English;
+			developmentRegion = en;
 			hasScannedForEncodings = 0;
 			knownRegions = (
 				en,
+				Base,
 			);
 			mainGroup = CD929A2D1AF4A2C3002F5C53;
 			productRefGroup = CD929A381AF4A2C3002F5C53 /* Products */;
@@ -832,6 +833,7 @@
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = CD748AE01B4440CB00632C3F /* Debug.xcconfig */;
 			buildSettings = {
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
@@ -851,7 +853,7 @@
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.ikesyo.$(PRODUCT_NAME:rfc1034identifier)";
-				SWIFT_VERSION = 4.0;
+				SWIFT_VERSION = 4.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VERSIONING_SYSTEM = "apple-generic";
@@ -864,6 +866,7 @@
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = CD748AE21B4440CB00632C3F /* Release.xcconfig */;
 			buildSettings = {
+				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
@@ -881,7 +884,7 @@
 				MTL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.ikesyo.$(PRODUCT_NAME:rfc1034identifier)";
 				SWIFT_COMPILATION_MODE = wholemodule;
-				SWIFT_VERSION = 4.0;
+				SWIFT_VERSION = 4.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VERSIONING_SYSTEM = "apple-generic";
diff --git a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme
index bcd9e8a..d3950d3 100644
--- a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme
+++ b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0930"
+   LastUpgradeVersion = "1020"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-macOS.xcscheme b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-macOS.xcscheme
index c6c998e..cadd52c 100644
--- a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-macOS.xcscheme
+++ b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-macOS.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0930"
+   LastUpgradeVersion = "1020"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-tvOS.xcscheme b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-tvOS.xcscheme
index 8f20206..7299c90 100644
--- a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-tvOS.xcscheme
+++ b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-tvOS.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0930"
+   LastUpgradeVersion = "1020"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-watchOS.xcscheme b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-watchOS.xcscheme
index 52f58a9..b3a6b05 100644
--- a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-watchOS.xcscheme
+++ b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-watchOS.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0930"
+   LastUpgradeVersion = "1020"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/Package.swift b/Package.swift
index 78f568f..41ca7d8 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,8 +1,11 @@
-// swift-tools-version:4.0
+// swift-tools-version:5.0
 import PackageDescription
 
 let package = Package(
     name: "Himotoki",
+    platforms: [
+        .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
+    ],
     products: [
         .library(name: "Himotoki", targets: ["Himotoki"]),
     ],
@@ -10,5 +13,5 @@ let package = Package(
         .target(name: "Himotoki", dependencies: [], path: "Sources"),
         .testTarget(name: "HimotokiTests", dependencies: ["Himotoki"]),
     ],
-    swiftLanguageVersions: [4]
+    swiftLanguageVersions: [.v5]
 )
diff --git a/Package@swift-4.2.swift b/Package@swift-4.2.swift
new file mode 100644
index 0000000..d686762
--- /dev/null
+++ b/Package@swift-4.2.swift
@@ -0,0 +1,14 @@
+// swift-tools-version:4.2
+import PackageDescription
+
+let package = Package(
+    name: "Himotoki",
+    products: [
+        .library(name: "Himotoki", targets: ["Himotoki"]),
+    ],
+    targets: [
+        .target(name: "Himotoki", dependencies: [], path: "Sources"),
+        .testTarget(name: "HimotokiTests", dependencies: ["Himotoki"]),
+    ],
+    swiftLanguageVersions: [.v4_2]
+)
diff --git a/README.md b/README.md
index 7858190..d75ccfd 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ let otherURLs: [URL] = try URLTransformer.apply(e <| "bar_urls")
 
 Himotoki 4.x requires / supports the following environments:
 
-- Swift 4.1 / Xcode 9.3 or later
+- Swift 4.2 / Xcode 10.1 or later
 - OS X 10.9 or later
 - iOS 8.0 or later
 - tvOS 9.0 or later
diff --git a/Sources/DecodeError.swift b/Sources/DecodeError.swift
index 0c4a309..32befa8 100644
--- a/Sources/DecodeError.swift
+++ b/Sources/DecodeError.swift
@@ -6,7 +6,7 @@
 //  Copyright © 2015 Syo Ikeda. All rights reserved.
 //
 
-public enum DecodeError: Error {
+public enum DecodeError: Error, Hashable {
     case missingKeyPath(KeyPath)
     case typeMismatch(expected: String, actual: String, keyPath: KeyPath)
     case custom(String)
@@ -27,37 +27,6 @@ extension DecodeError: CustomDebugStringConvertible {
     }
 }
 
-extension DecodeError: Hashable {
-    public static func == (lhs: DecodeError, rhs: DecodeError) -> Bool {
-        switch (lhs, rhs) {
-        case let (.missingKeyPath(l), .missingKeyPath(r)):
-            return l == r
-
-        case let (.typeMismatch(la, lb, lc), .typeMismatch(ra, rb, rc)):
-            return la == ra && lb == rb && lc == rc
-
-        case let (.custom(l), .custom(r)):
-            return l == r
-
-        default:
-            return false
-        }
-    }
-
-    public var hashValue: Int {
-        switch self {
-        case let .missingKeyPath(keyPath):
-            return keyPath.hashValue
-
-        case let .typeMismatch(expected, actual, keyPath):
-            return expected.hashValue ^ actual.hashValue ^ keyPath.hashValue
-
-        case let .custom(message):
-            return message.hashValue
-        }
-    }
-}
-
 public func missingKeyPath(_ keyPath: KeyPath) -> DecodeError {
     return DecodeError.missingKeyPath(keyPath)
 }
diff --git a/Sources/KeyPath.swift b/Sources/KeyPath.swift
index 425fea1..04961b0 100644
--- a/Sources/KeyPath.swift
+++ b/Sources/KeyPath.swift
@@ -6,7 +6,7 @@
 //  Copyright (c) 2015 Syo Ikeda. All rights reserved.
 //
 
-public struct KeyPath {
+public struct KeyPath: Hashable {
     public let components: [String]
 
     public init(_ key: String) {
@@ -26,16 +26,6 @@ extension KeyPath {
     }
 }
 
-extension KeyPath: Hashable {
-    public static func == (lhs: KeyPath, rhs: KeyPath) -> Bool {
-        return lhs.components == rhs.components
-    }
-
-    public var hashValue: Int {
-        return components.reduce(0) { $0 ^ $1.hashValue }
-    }
-}
-
 extension KeyPath: CustomDebugStringConvertible {
     public var debugDescription: String {
         return "KeyPath(\(components))"