From 744c094976355aa96ca61b9b60ef0a38e979feb7 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Sun, 27 Oct 2019 23:17:36 +0300 Subject: [PATCH] Don't depend on Foundation since Swift 4.2 (#58) Before Swift 4.2 the `hasSuffix(_:)` method of `String` was unavailable on non-Darwin platforms without importing Foundation. In Swift 4.2 this was fixed. This allows us to not depend on Foundation on newer versions of Swift at all. --- Sources/HTMLEntities/Constants.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/HTMLEntities/Constants.swift b/Sources/HTMLEntities/Constants.swift index 8ca4382..8af5051 100644 --- a/Sources/HTMLEntities/Constants.swift +++ b/Sources/HTMLEntities/Constants.swift @@ -14,8 +14,9 @@ * limitations under the License. */ -// Linux toolchain requires Foundation to resolve `String` class's `hasSuffix()` function -#if os(Linux) +// Linux toolchain required Foundation to resolve `String` class's `hasSuffix()` function +// before Swift 4.2. +#if !swift(>=4.2) && os(Linux) import Foundation #endif