Skip to content

Commit

Permalink
Expose init for ResultChildMetadata with field values (#340)
Browse files Browse the repository at this point in the history
* Expose init for ResultChildMetadata with field values

Co-authored-by: Nastassia Makaranka <[email protected]>
  • Loading branch information
maios and kried authored Nov 12, 2024
1 parent 195d732 commit 5dbdaee
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Guide: https://keepachangelog.com/en/1.0.0/

<!-- Add changes for active work here -->

- [ResultChildMetadata] Add ResultChildMetadata.init(category:coordinate:mapboxId:name)

## 2.6.0-rc.1

- [Core] Update dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,27 @@ public struct ResultChildMetadata: Codable, Hashable {
}
self.name = resultChildMetadata.name
}

/// Initializes a new instance of `ResultChildMetadata` with optional category, coordinates, and name,
/// and a required `mapboxId`.
///
/// - Parameters:
/// - mapboxId: A required `String` that uniquely identifies the Mapbox object. This is a required
/// parameter and must be provided during initialization.
/// - name: An optional `String` representing the name of the result.
/// - category: An optional `String` representing the category of the result.
/// - coordinate: An optional `CLLocationCoordinate2D` representing the geographical location
/// associated with the result. If provided, it is transformed to a `CLLocationCoordinate2DCodable`
/// instance for storage.
public init(
mapboxId: String,
name: String? = nil,
category: String? = nil,
coordinate: CLLocationCoordinate2D? = nil
) {
self.category = category
self.coordinatesCodable = coordinate.map(CLLocationCoordinate2DCodable.init)
self.mapboxId = mapboxId
self.name = name
}
}

0 comments on commit 5dbdaee

Please sign in to comment.