Skip to content

Commit 744c094

Browse files
broadwaylambianpartridge
authored andcommitted
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.
1 parent 97b51ef commit 744c094

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/HTMLEntities/Constants.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
// Linux toolchain requires Foundation to resolve `String` class's `hasSuffix()` function
18-
#if os(Linux)
17+
// Linux toolchain required Foundation to resolve `String` class's `hasSuffix()` function
18+
// before Swift 4.2.
19+
#if !swift(>=4.2) && os(Linux)
1920
import Foundation
2021
#endif
2122

0 commit comments

Comments
 (0)