Skip to content

Commit

Permalink
Don't depend on Foundation since Swift 4.2 (#58)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
broadwaylamb authored and ianpartridge committed Oct 27, 2019
1 parent 97b51ef commit 744c094
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/HTMLEntities/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 744c094

Please sign in to comment.