The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.6.0...v2.6.1) since [v2.6.0](https://github.com/mapbox/turf-swift/releases/tag/v2.6.0):
* Removed unused schemes to fix a build failure when installing this library using Carthage. ([#201](https://github.com/mapbox/turf-swift/pull/201))
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.5.0...v2.6.0) since [v2.5.0](https://github.com/mapbox/turf-swift/releases/tag/v2.5.0):
## Packaging
* This library now requires a minimum deployment target of iOS 11.0 or above, macOS 10.13.0 or above, tvOS 11.0 or above, or watchOS 4.0 or above. Older operating system versions are no longer supported. ([#198](https://github.com/mapbox/turf-swift/pull/198))
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
v2.6.0-beta.1
32 weeks ago
[Changes](https://github.com/mapbox/turf-swift/compare/v2.5.0...v2.6.0-beta.1) since [v2.5.0](https://github.com/mapbox/turf-swift/releases/tag/v2.5.0):
## Packaging
* This library now requires a minimum deployment target of iOS 11.0 or above, macOS 10.13.0 or above, tvOS 11.0 or above, or watchOS 4.0 or above. Older operating system versions are no longer supported. ([#198](https://github.com/mapbox/turf-swift/pull/198))
[Changes](https://github.com/mapbox/turf-swift/compare/v2.4.0...v2.5.0) since [v2.4.0](https://github.com/mapbox/turf-swift/releases/tag/v2.4.0):
* Improved the algorithmic performance of `LineString.trimmed(from:to:)`. (#192)
Documentation is [available online](https://mapbox.github.io/turf-swift/2.5.0/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.3.0...v2.4.0) since [v2.3.0](https://github.com/mapbox/turf-swift/releases/tag/v2.3.0):
* Foreign members in GeoJSON are no longer encoded or decoded by default for performance reasons. To enable encoding or decoding of foreign members, set the `CodingUserInfoKey.includesForeignMembers` option to `true` in `JSONEncoder.userInfo` or `JSONDecoder.userInfo`, respectively. (#187)
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.2.0...v2.3.0) since [v2.2.0](https://github.com/mapbox/turf-swift/releases/tag/v2.2.0):
* Fixed an issue where a GeoJSON feature property set to the integer 0 or 1 was converted to a Boolean when encoding or decoding the feature. (#181)
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.1.0...v2.2.0) since [v2.1.0](https://github.com/mapbox/turf-swift/releases/tag/v2.1.0):
* The `Feature`, `FeatureCollection`, `GeometryCollection`, `LineString`, `MultiLineString`, `MultiPoint`, `MultiPolygon`, `Point`, and `Polygon` structs now conform to the `ForeignMemberContainer` protocol. [Foreign members](https://datatracker.ietf.org/doc/html/rfc7946#section-6.1) (unrecognized properties outside of `properties`) are stored in the `ForeignMemberContainer.foreignMembers` property and round-tripped to JSON. (#175)
* `Ring` now conforms to the `Codable` protocol. (#175)
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.0.0...v2.1.0) since [v2.0.0](https://github.com/mapbox/turf-swift/releases/tag/v2.0.0):
* Added `LineString.trimmed(from:to:)` method that returns a sliced `LineString` based on the starting and stopping distances.
* Added `Linestring.intersection(with:)` method that returns all the intersections of the `LineString` with another one.
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v1.2.0...v2.0.0) since [v1.2.0](https://github.com/mapbox/turf-swift/releases/tag/v1.2.0):
## Packaging
* ⚠️ Turf requires Xcode 12.0 or above to build from source. (#152)
* ⚠️ When installing this library using Carthage, Carthage builds it with library evolution enabled. (#134)
* Turf is now 100% documented. [A full API reference](https://mapbox.github.io/turf-swift/) is available online. (#162)
## Geometry
* ⚠️ Replaced the Linux-specific definitions of `CLLocationCoordinate2D`, `CLLocationDirection`, `CLLocationDistance`, and `CLLocationDegrees` with `LocationCoordinate2D`, `LocationDirection`, `LocationDistance`, and `LocationDegrees`, respectively. On Apple platforms, the new types remain type aliases, so you can continue to use the familiar `CL`-prefixed Core Location types unless you are writing cross-platform code that supports Linux. (#132)
* ⚠️ Combined the `GeoJSON` class and `GeoJSON` protocol into a unified `GeoJSONObject` enumeration. Use `JSONDecoder` instead of the `GeoJSON.parse(_:)` or `GeoJSON.parse<T: GeoJSONObject>(_:from:)` method. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
if let feature = try GeoJSON.parse(data)?.decodedFeature,
case let .lineString(lineString) = feature.geometry { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
if case let .feature(feature) = try JSONDecoder().decode(GeoJSONObject.self, from: data),
case let .lineString(lineString) = feature.geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `FeatureCollection.identifier` and `FeatureCollection.properties` properties with no replacement. These properties had been represented in GeoJSON by foreign members, which are not yet implemented. If you had been relying on the `identifier` or `properties` foreign members of FeatureCollection objects, move the data to each individual feature in the collection. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
let uuid = UUID().description
featureCollection.identifier = .string(uuid)
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
let uuid = UUID().description
for feature in featureCollection.features {
$0.identifier = .string(uuid)
}
```
</td>
</tr>
</table>
* ⚠️ The `Feature.properties` property is now a `JSONObject?` (in other words, `[String: JSONValue?]?`). JSONObject is type-checked at compile time instead of runtime, but you can initialize it using a literal or full-width conversion from `Any?`. Code that builds a JSON object using literals will have to be modified to either specify a `JSONValue` case for each value or call the `JSONObject(rawValue:)` initializer. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
feature.properties = [
"name": "Wapakoneta",
"population": 9_957,
"favorite": isFavorite,
]
let isBigCity = (feature.properties?["population"] as? Double).flatMap { $0 > 10_000 }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
feature.properties = [
"name": "Wapakoneta",
"population": 9_957,
"favorite": .boolean(isFavorite),
]
var isBigCity: Bool?
if case let .number(population) = feature.properties?["population"] {
isBigCity = population > 10_000
}
```
</td>
</tr>
</table>
* ⚠️ The `Feature.geometry` property is now optional. (#154)
* ⚠️ Removed the `Geometry.type` property. Use pattern matching (`case let`) instead. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
if geometry.type == .Point { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
if case .point = geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `Geometry.value` property. This type erasure is unnecessary and can potentially become a source of bugs. Use pattern matching instead. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
if let point = geometry.value as? Point { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
if case let .point(point) = geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `Number` enumeration in favor of a `Double`-typed `FeatureIdentifier.number(_:)` case. JSON doesn’t distinguish between integers and double-precision floating point numbers. Any distinction in the type system or encoded JSON is purely cosmetic. (#154)
<table>
<tr>
<th scope="row">v1.<var>x</var></th>
<td>
```swift
let randomNumber = Int.random(in: 0...255)
feature.identifier = .number(.int(randomNumber))
if let number = feature.identifier?.value as? Int {
print("You rolled a \(number)!")
}
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0</th>
<td>
```swift
let randomNumber = Int.random(in: 0...255)
feature.identifier = .number(Double(randomNumber))
if let .number(number) = feature.identifier {
print("You rolled a \(Int(number))!")
}
```
</td>
</tr>
</table>
* ⚠️ Renamed the `BoundingBox(_:_:)` initializer to `BoundingBox(southWest:northEast:)`. (#132)
* `Feature` and `FeatureCollection` now conform to the `Equatable` protocol. (#154)
* Each geometric type, such as `Point`, now conforms to the `Codable` and `Equatable` protocols. (#154)
* `BoundingBox` and `FeatureIdentifier` now conform to the `Hashable` protocol. (#154, #159)
## Trigonometry
* ⚠️ The `RadianCoordinate2D.direction(to:)` method now returns a `Measurement<UnitAngle>` instead of a `RadianDirection`, and the `RadianCoordinate2D.coordinate(at:facing:)` method now accepts a `Measurement<UnitAngle>` instance instead of a `RadianDirection`. The `LocationCoordinate2D.coordinate(at:facing:)` method can now accept a `Measurement<UnitAngle>` instance instead of a `LocationDirection` instance. (#143)
* Added the `Polygon.smooth(iterations:)` method for polygon smoothing. (#137)
* Added the `Polygon.simplify(tolerance:highestQuality)` method in both non-mutating and mutating forms. (#138)
* Added the `LineString.bezier(resolution:sharpness:)` method for calculating a Bézier curve. (#140)
* Added the `Polygon.center`, `Polygon.centroid`, and `Polygon.centerOfMass` properties. (#148)
Documentation is [available online](https://mapbox.github.io/turf-swift/) or within Xcode.
[Changes](https://github.com/mapbox/turf-swift/compare/v2.0.0-rc.1...v2.0.0-rc.2) since [v2.0.0-rc.1](https://github.com/mapbox/turf-swift/releases/tag/v2.0.0-rc.1):
## Packaging
* ⚠️ Turf requires Xcode 12.0 or above to build from source. (#152)
## Geometry
* ⚠️ Replaced the `GeoJSON` class and `GeoJSON` protocol with a unified `GeoJSONObject` enumeration. Use `JSONDecoder` instead of the `GeoJSON.parse(_:)` or `GeoJSON.parse<T: GeoJSONObject>(_:from:)` method. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
if let feature = try GeoJSON.parse(data)?.decodedFeature,
case let .lineString(lineString) = feature.geometry { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
if case let .feature(feature) = try JSONDecoder().decode(GeoJSONObject.self, from: data),
case let .lineString(lineString) = feature.geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `FeatureCollection.identifier` and `FeatureCollection.properties` properties with no replacement. These properties had been represented in GeoJSON by foreign members, which are not yet implemented. If you had been relying on the `identifier` or `properties` foreign members of FeatureCollection objects, move the data to each individual feature in the collection. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
let uuid = UUID().description
featureCollection.identifier = .string(uuid)
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
let uuid = UUID().description
for feature in featureCollection.features {
$0.identifier = .string(uuid)
}
```
</td>
</tr>
</table>
* ⚠️ The `Feature.properties` property is now a `JSONObject?` (in other words, `[String: JSONValue?]?`). JSONObject is type-checked at compile time instead of runtime, but you can initialize it using a literal or full-width conversion from `Any?`. Code that builds a JSON object using literals will have to be modified to either specify a `JSONValue` case for each value or call the `JSONObject(rawValue:)` initializer. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
feature.properties = [
"name": "Wapakoneta",
"population": 9_957,
"favorite": isFavorite,
]
let isBigCity = (feature.properties?["population"] as? Double).flatMap { $0 > 10_000 }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
feature.properties = [
"name": "Wapakoneta",
"population": 9_957,
"favorite": .boolean(isFavorite),
]
var isBigCity: Bool?
if case let .number(population) = feature.properties?["population"] {
isBigCity = population > 10_000
}
```
</td>
</tr>
</table>
* ⚠️ The `Feature.geometry` property is now optional. (#154)
* ⚠️ Removed the `Geometry.type` property. Use pattern matching (`case let`) instead. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
if geometry.type == .Point { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
if case .point = geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `Geometry.value` property. This type erasure is unnecessary and can potentially become a source of bugs. Use pattern matching instead. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
if let point = geometry.value as? Point { … }
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
if case let .point(point) = geometry { … }
```
</td>
</tr>
</table>
* ⚠️ Removed the `Number` enumeration in favor of a `Double`-typed `FeatureIdentifier.number(_:)` case. JSON doesn’t distinguish between integers and double-precision floating point numbers. Any distinction in the type system or encoded JSON is purely cosmetic. (#154)
<table>
<tr>
<th scope="row">v2.0.0-rc.1</th>
<td>
```swift
let randomNumber = Int.random(in: 0...255)
feature.identifier = .number(.int(randomNumber))
if let number = feature.identifier?.value as? Int {
print("You rolled a \(number)!")
}
```
</td>
</tr>
<tr>
<th scope="row">v2.0.0-rc.2</th>
<td>
```swift
let randomNumber = Int.random(in: 0...255)
feature.identifier = .number(Double(randomNumber))
if let .number(number) = feature.identifier {
print("You rolled a \(Int(number))!")
}
```
</td>
</tr>
</table>
* `Feature` and `FeatureCollection` now conform to the `Equatable` protocol. (#154)
* Each geometric type, such as `Point`, now conforms to the `Codable` and `Equatable` protocols. (#154)
* `BoundingBox` now conforms to the `Hashable` protocol. (#154)
## Trigonometry
* Fixed an issue where the `LineString.simplify(tolerance:highestQuality:)` method returned a highest-quality result even if the `highestQuality` parameter was set to `false`. (#152)
* Fixed an issue where the `Polygon.simplify(tolerance:highestQuality:)` method incorrectly applied the tolerance. (#152)
* Fixed an issue where the `Polygon.simplify(tolerance:highestQuality:)` method failed to simplify the polygon at all if any of the linear rings was a triangle. (#152)