Add native Swift package, improve inverses, and document both APIs - #8
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a native Swift package and modernizes the existing Objective-C implementation, documentation and verification.
The original GCJ-02 inverse can select an incorrect search quadrant and silently return a distant coordinate at its iteration limit. For example, converting WGS-84
(35.25, 114.25)to GCJ-02 and back returns latitude35.251493380238543, approximately 166 meters away. The original Objective-C functions reproduce this regression. Both implementations now use bounded residual iteration and report invalid results or non-convergence.Validation:
Also completed locally:
swift testandswift test -c release: 15 tests passed, including independent forward fixtures, 4,088 grid points across all six directions, seeded non-grid samples, longitude-105/edge cases, legacy regressions, concurrency and Swift/Objective-C parity.git diff --checkpassed. CocoaPods 1.17.0 is pinned with a Gemfile/lockfile. Independent Objective-C and Swift application consumers build and run with static-library, static-framework and dynamic-framework linkage. Local Xcode 27 smoke builds set the macOS deployment target to 12.0 and run on macOS 27; CI uses Xcode 16.4 to validate the original declared minimum targets without an override.The reproducible Release benchmark over 8,547 deterministic samples observed a maximum numerical round-trip error of 270.95 m for the old search versus 0.000139 m for residual iteration, with about 13.5× lower runtime in that run. These are errors within the same community forward model, not real-world map accuracy or universal performance guarantees; the research documents explain this distinction and external implementation differences.
Compatibility notes: modern distribution requires Swift 6 / iOS 13 (other platform minima in the manifest); inverse results improve numerically; invalid inputs now fail explicitly. New checked APIs apply the selected region policy once to the input for every pair. Legacy methods remain unrestricted. Near polygon boundaries, callers should choose applicability explicitly.
Follow-up quality checks:
Test/.DS_Storeand reject tracked OS metadata, build caches and personal IDE settings in CI, including force-added files. A temporary Git index regression check confirmed clean files pass and forced metadata/build/IDE files fail.Scripts/test-cocoapods.rb; generated consumer projects and artifacts stay under ignored.build/cocoapods/. CocoaPods validation does not use--allow-warnings,--quickor skip-import flags.pod spec lintremains a release-time check because tag1.0.0has not been created. No release or trunk publication is performed by this PR.