-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend CLLocationCoordinate2D with isValid
computed property
#102
Conversation
Extend CLLocationCoordinate2D with `isValid` computed property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the import should be CoreLocation.
Sources/UtiliKit/General/CLLocationCoordinate2D+Extensions.swift
Outdated
Show resolved
Hide resolved
Sources/UtiliKit/General/CLLocationCoordinate2D+Extensions.swift
Outdated
Show resolved
Hide resolved
Co-authored-by: Earl Gaspard <83370606+br-earl-gaspard@users.noreply.github.com>
Incorporate PR feedback Change import
It would be great to get some unit tests added for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just needs an entry added in CHANGELOG.md
.
Should it be a new version number? |
@andrew-winn-br just an entry under the "Enhancements" section. We'll create a version number entry when we do the next release of Utilikit. See this change on a previous PR for an example. |
Add tests Update Change log
Tests/UtiliKitTests.swift
Outdated
longitude: CLLocationDegrees(-180)) | ||
] | ||
|
||
XCTAssertNil(coordinates.first { !$0.isValid }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may just be personal preference, but to me this would be more clear as XCTAssertTrue(coordinates.allSatisfy { $0.isValid })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I can change it and the invalid coordinates test.
Clarify tests.
6176de8
@rmirabelli looks like this just needs your thumbs up for us to go ahead and merge. |
@andrew-winn-br I think in addition to Russell's re-approval we'll want to merge in the changes from main to get the updated CI running over the PR. |
You know what, looking at it - it's a small enough change that I'll just deal with any weirdness on the release branch :). Merging. |
Attempting to use an invalid coordinate will crash the app. This provides a convenient computed property to check if a CLLocationCoordinate2D is valid or not.