Skip to content

Commit 0665b4d

Browse files
committed
Adds Swift Package Manager Support and removes Cocoapods
* Breaking changes from Grid 2.0.0 and SimpleFeatures 5.0.0 integrated
1 parent 42c5c9d commit 0665b4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+540
-1182
lines changed

.github/workflows/build-test.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@ jobs:
1313

1414
steps:
1515
- name: Checkout Repository
16-
uses: actions/checkout@v3
17-
- name: Install
18-
run: pod install
16+
uses: actions/checkout@v4
17+
1918
- name: Build
20-
run: xcodebuild build-for-testing -workspace mgrs-ios.xcworkspace -scheme mgrs-ios -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14'
19+
run: |
20+
iphone_names=$(xcrun simctl list devices available --json | jq -r '.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+")) | .name')
21+
if [ -z "$iphone_names" ]; then echo "Error: No iPhone simulators found."; exit 1; fi
22+
latest_iphone=$(echo "$iphone_names" | sort | tail -n 1)
23+
echo "latest_iphone: $latest_iphone"
24+
xcodebuild build -scheme MGRS -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"
25+
26+
- name: Test
27+
run: |
28+
iphone_names=$(xcrun simctl list devices available --json | jq -r '.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+")) | .name')
29+
if [ -z "$iphone_names" ]; then echo "Error: No iPhone simulators found."; exit 1; fi
30+
latest_iphone=$(echo "$iphone_names" | sort | tail -n 1)
31+
echo "latest_iphone: $latest_iphone"
32+
xcodebuild test -scheme MGRS -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ xcuserdata/
66
*.swp
77
Carthage/
88
build/
9+
.build/

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ Adheres to [Semantic Versioning](http://semver.org/).
44

55
---
66

7-
## 1.1.7 (TBD)
7+
## 2.0.0 (5-22-2025)
88

9-
* TBD
9+
* Adds Swift Package Manager support
10+
* Breaking change: Removes Cocoapods (deprecated)
11+
* Builds against new Grid 2.0.0 (grid-ios) and SimpleFeatures 5.0.0 (sf-ios) with new enum symbols exposed to Swift
1012

1113
## [1.1.6](https://github.com/ngageoint/mgrs-ios/releases/tag/1.1.6) (04-08-2024)
1214

Package.resolved

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// swift-tools-version: 5.10
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "MGRS",
7+
platforms: [.macOS(.v11), .iOS(.v13)],
8+
products: [
9+
.library(
10+
name: "MGRS",
11+
targets: ["MGRS"])
12+
],
13+
dependencies: [
14+
.package(url: "https://github.com/ngageoint/grid-ios", branch: "psolt/package") // FIXME: Update to published release (2.0.0 version)
15+
],
16+
targets: [
17+
.target(
18+
name: "MGRS",
19+
dependencies: [
20+
.product(name: "Grid", package: "grid-ios")
21+
],
22+
path: "mgrs-ios",
23+
resources: [
24+
.copy("mgrs.plist"),
25+
]
26+
),
27+
.testTarget(
28+
name: "MGRSTests",
29+
dependencies: [
30+
"MGRS"
31+
],
32+
path: "mgrs-iosTests"
33+
)
34+
]
35+
)

Podfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ View the latest [Appledoc](http://ngageoint.github.io/mgrs-ios/docs/api/)
2121

2222
```swift
2323

24-
import mgrs_ios
24+
import MGRS
2525

2626
```
2727

@@ -192,7 +192,7 @@ if zoomGrids.hasGrids() {
192192

193193
```objectivec
194194

195-
#import "mgrs_ios-Swift.h"
195+
#import "MGRS-Swift.h"
196196

197197
```
198198

@@ -205,36 +205,37 @@ MKTileOverlay *tileOverlay = [[MGRSTileOverlay alloc] init];
205205
206206
### Build ###
207207
208-
[![Build & Test](https://github.com/ngageoint/mgrs-ios/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/mgrs-ios/actions/workflows/build-test.yml)
208+
[![Build](https://github.com/ngageoint/mgrs-ios/workflows/Build/badge.svg)](https://github.com/ngageoint/mgrs-ios/actions/workflows/build.yml)
209209
210-
Build this repository using Xcode and/or CocoaPods:
210+
Build and Test (Uses UIKit, so we build with xcodebuild instead of SPM).
211211
212-
pod install
212+
./build.sh
213213
214-
Open mgrs-ios.xcworkspace in Xcode or build from command line:
214+
You can build and test if you open the Package.swift in Xcode.
215215
216-
xcodebuild -workspace 'mgrs-ios.xcworkspace' -scheme mgrs-ios build
217-
218-
Run tests from Xcode or from command line:
219-
220-
xcodebuild test -workspace 'mgrs-ios.xcworkspace' -scheme mgrs-ios -destination 'platform=iOS Simulator,name=iPhone 15'
221216
222217
### Include Library ###
223218
224-
Include this repository by specifying it in a Podfile using a supported option.
225-
226-
Pull from [CocoaPods](https://cocoapods.org/pods/mgrs-ios):
227-
228-
pod 'mgrs-ios', '~> 1.1.6'
219+
Use this library via SPM in your Package.swift:
229220
230-
Pull from GitHub:
221+
dependencies: [
222+
.package(url: "https://github.com/ngageoint/mgrs-ios.git", branch: "release/2.0.0"),
223+
]
224+
225+
Or as a tagged release:
231226
232-
pod 'mgrs-ios', :git => 'https://github.com/ngageoint/mgrs-ios.git', :branch => 'master'
233-
pod 'mgrs-ios', :git => 'https://github.com/ngageoint/mgrs-ios.git', :tag => '1.1.6'
227+
dependencies: [
228+
.package(url: "https://github.com/ngageoint/mgrs-ios.git", from: "2.0.0"),
229+
]
234230
235-
Include as local project:
231+
Reference it in your Package.swift target:
236232
237-
pod 'mgrs-ios', :path => '../mgrs-ios'
233+
.target(
234+
name: "MyApp",
235+
dependencies: [
236+
.product(name: "MGRS", package: "mgrs-ios"),
237+
],
238+
),
238239
239240
### Remote Dependencies ###
240241

0 commit comments

Comments
 (0)