Skip to content

Commit d0d8cd3

Browse files
committed
Adds Swift Package Manager (SPM) for version 2.0.0
* Removes Cocoapods * Exposes C enum with NS_ENUM for Swift interoperability * Updates Github workflow for SPM
1 parent 2b844cc commit d0d8cd3

File tree

171 files changed

+837
-2284
lines changed

Some content is hidden

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

171 files changed

+837
-2284
lines changed

.github/workflows/build-test.yml

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

.github/workflows/build.yml

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

1414
steps:
1515
- name: Checkout Repository
16-
uses: actions/checkout@v3
17-
- name: Install Utilities
18-
run: |
19-
brew install automake
20-
brew install libtool
21-
- name: Install
22-
run: pod install
16+
uses: actions/checkout@v4
2317
- name: Build
24-
run: xcodebuild build-for-testing -workspace crs-ios.xcworkspace -scheme crs-ios -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14'
18+
run: swift build
19+
- name: Test
20+
run: swift test

.gitignore

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

CHANGELOG.md

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

55
---
66

7-
## 1.0.6 (TBD)
8-
9-
* TBD
7+
## 2.0.0 (6-3-2025)
8+
9+
* Swift Package Manager support exposes public headers and restructures code for SPM format.
10+
* Renamed framework from crs-ios to CoordinateReferenceSystems in SPM (dashes break SPM bundle resources)
11+
* Updated to use `NS_ENUM` for C `enum` for Swift/Objective-C interoperability
12+
* Updated tests (Objective-C based and Swift based tests)
13+
* Removed Cocoapods (deprecated)
14+
* Updated build instructions and github workflows
1015

1116
## [1.0.5](https://github.com/ngageoint/coordinate-reference-systems-ios/releases/tag/1.0.5) (11-07-2023)
1217

Cartfile

Whitespace-only changes.

Cartfile.resolved

Whitespace-only changes.

Package.swift

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// swift-tools-version:5.10
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "CoordinateReferenceSystems",
7+
platforms: [
8+
.iOS(.v13), .macOS(.v12)
9+
],
10+
products: [
11+
.library(
12+
name: "CoordinateReferenceSystems",
13+
targets: ["CoordinateReferenceSystems"]),
14+
],
15+
dependencies: [
16+
],
17+
targets: [
18+
.target(
19+
name: "CoordinateReferenceSystems",
20+
dependencies: [
21+
],
22+
path: "crs-ios",
23+
exclude: [
24+
],
25+
publicHeadersPath: "include"
26+
),
27+
.testTarget(
28+
name: "CoordinateReferenceSystemsTests",
29+
dependencies: [
30+
"CoordinateReferenceSystems",
31+
],
32+
path: "crs-iosTests",
33+
cSettings: [
34+
.headerSearchPath("."),
35+
.headerSearchPath("common"),
36+
.headerSearchPath("util/proj"),
37+
.headerSearchPath("wkt"),
38+
]
39+
),
40+
.testTarget(
41+
name: "CoordinateReferenceSystemsTests-Swift",
42+
dependencies: [
43+
"CoordinateReferenceSystems",
44+
],
45+
path: "crs-iosTests-swift",
46+
sources: ["."]
47+
),
48+
]
49+
)

Podfile

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

README.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ For projection conversions between coordinates, see [Projections](https://ngageo
2020
View the latest [Appledoc](http://ngageoint.github.io/coordinate-reference-systems-ios/docs/api/)
2121

2222
```objectivec
23+
@import CoordinateReferenceSystems;
2324

2425
// NSString *wkt = ...
2526

2627
CRSObject *crs = [CRSReader read:wkt];
2728

28-
enum CRSType type = crs.type;
29-
enum CRSCategoryType category = crs.categoryType;
29+
CRSType type = crs.type;
30+
CRSCategoryType category = crs.categoryType;
3031

3132
NSString *text = [CRSWriter write:crs];
3233
NSString *prettyText = [CRSWriter writePretty:crs];
@@ -164,45 +165,50 @@ NSString *projTextFromWKT = [CRSProjParser paramsTextFromText:wkt];
164165

165166
### Build ###
166167

167-
[![Build & Test](https://github.com/ngageoint/coordinate-reference-systems-ios/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/coordinate-reference-systems-ios/actions/workflows/build-test.yml)
168+
[![Build](https://github.com/ngageoint/coordinate-reference-systems-ios/actions/workflows/build.yml/badge.svg)](https://github.com/ngageoint/coordinate-reference-systems-ios/actions/workflows/build.yml)
168169

169-
Build this repository using Xcode and/or CocoaPods:
170+
Build this repository using Swift Package Manager:
170171

171-
pod repo update
172-
pod install
172+
swift build
173173

174-
Open crs-ios.xcworkspace in Xcode or build from command line:
175-
176-
xcodebuild -workspace 'crs-ios.xcworkspace' -scheme crs-ios build
177174

178175
Run tests from Xcode or from command line:
179176

180-
xcodebuild test -workspace 'crs-ios.xcworkspace' -scheme crs-ios -destination 'platform=iOS Simulator,name=iPhone 15'
177+
swift test
181178

182-
### Include Library ###
179+
Open the Swift Package in Xcode from command line:
183180

184-
Include this repository by specifying it in a Podfile using a supported option.
181+
open Package.swift
185182

186-
Pull from [CocoaPods](https://cocoapods.org/pods/crs-ios):
183+
### Include Library ###
187184

188-
pod 'crs-ios', '~> 1.0.5'
185+
Use this library via SPM in your Package.swift:
189186

190-
Pull from GitHub:
187+
dependencies: [
188+
.package(url: "https://github.com/ngageoint/coordinate-reference-systems-ios.git", branch: "release/2.0.0"),
189+
]
190+
191+
Or as a tagged release:
191192

192-
pod 'crs-ios', :git => 'https://github.com/ngageoint/coordinate-reference-systems-ios.git', :branch => 'master'
193-
pod 'crs-ios', :git => 'https://github.com/ngageoint/coordinate-reference-systems-ios.git', :tag => '1.0.5'
193+
dependencies: [
194+
.package(url: "https://github.com/ngageoint/coordinate-reference-systems-ios.git", from: "2.0.0"),
195+
]
194196

195-
Include as local project:
197+
Reference it in your Package.swift target:
196198

197-
pod 'crs-ios', :path => '../coordinate-reference-systems-ios'
199+
.target(
200+
name: "projections",
201+
dependencies: [
202+
.product(name: "CoordinateReferenceSystems", package: "coordinate-reference-systems-ios"),
203+
],
204+
),
198205

199206
### Swift ###
200207

201-
To use from Swift, import the crs-ios bridging header from the Swift project's bridging header
202-
203-
#import "crs-ios-Bridging-Header.h"
208+
Import the framework in Swift.
204209

205210
```swift
211+
import CoordinateReferenceSystems
206212

207213
// var wkt: String = ...
208214

@@ -216,44 +222,44 @@ let prettyText : String = CRSWriter.writePretty(crs)
216222

217223
switch category{
218224

219-
case CRS_CATEGORY_CRS:
225+
case .CATEGORY_CRS:
220226

221227
let coordRefSys : CRSCoordinateReferenceSystem = crs as! CRSCoordinateReferenceSystem
222228

223229
switch type {
224-
case CRS_TYPE_BOUND:
230+
case .TYPE_BOUND:
225231
let bound : CRSBoundCoordinateReferenceSystem = coordRefSys as! CRSBoundCoordinateReferenceSystem
226232
// ...
227233
break
228-
case CRS_TYPE_COMPOUND:
234+
case .TYPE_COMPOUND:
229235
let compound : CRSCompoundCoordinateReferenceSystem = coordRefSys as! CRSCompoundCoordinateReferenceSystem
230236
// ...
231237
break
232-
case CRS_TYPE_DERIVED:
238+
case .TYPE_DERIVED:
233239
let derived : CRSDerivedCoordinateReferenceSystem = coordRefSys as! CRSDerivedCoordinateReferenceSystem
234240
// ...
235241
break
236-
case CRS_TYPE_ENGINEERING:
242+
case .TYPE_ENGINEERING:
237243
let engineering : CRSEngineeringCoordinateReferenceSystem = coordRefSys as! CRSEngineeringCoordinateReferenceSystem
238244
// ...
239245
break
240-
case CRS_TYPE_GEODETIC, CRS_TYPE_GEOGRAPHIC:
246+
case .TYPE_GEODETIC, .TYPE_GEOGRAPHIC:
241247
let geo : CRSGeoCoordinateReferenceSystem = coordRefSys as! CRSGeoCoordinateReferenceSystem
242248
// ...
243249
break
244-
case CRS_TYPE_PARAMETRIC:
250+
case .TYPE_PARAMETRIC:
245251
let parametric : CRSParametricCoordinateReferenceSystem = coordRefSys as! CRSParametricCoordinateReferenceSystem
246252
// ...
247253
break
248-
case CRS_TYPE_PROJECTED:
254+
case .TYPE_PROJECTED:
249255
let projected : CRSProjectedCoordinateReferenceSystem = coordRefSys as! CRSProjectedCoordinateReferenceSystem
250256
// ...
251257
break
252-
case CRS_TYPE_TEMPORAL:
258+
case .TYPE_TEMPORAL:
253259
let temporal : CRSTemporalCoordinateReferenceSystem = coordRefSys as! CRSTemporalCoordinateReferenceSystem
254260
// ...
255261
break
256-
case CRS_TYPE_VERTICAL:
262+
case .TYPE_VERTICAL:
257263
let vertical : CRSVerticalCoordinateReferenceSystem = coordRefSys as! CRSVerticalCoordinateReferenceSystem
258264
// ...
259265
break
@@ -264,27 +270,27 @@ case CRS_CATEGORY_CRS:
264270
// ...
265271
break
266272

267-
case CRS_CATEGORY_METADATA:
273+
case .CATEGORY_METADATA:
268274

269275
let metadata : CRSCoordinateMetadata = crs as! CRSCoordinateMetadata
270276

271277
// ...
272278
break
273279

274-
case CRS_CATEGORY_OPERATION:
280+
case .CATEGORY_OPERATION:
275281

276282
let operation = crs as! CRSOperation
277283

278284
switch type {
279-
case CRS_TYPE_CONCATENATED_OPERATION:
285+
case .TYPE_CONCATENATED_OPERATION:
280286
let concatenatedOperation : CRSConcatenatedOperation = operation as! CRSConcatenatedOperation
281287
// ...
282288
break
283-
case CRS_TYPE_COORDINATE_OPERATION:
289+
case .TYPE_COORDINATE_OPERATION:
284290
let coordinateOperation : CRSCoordinateOperation = operation as! CRSCoordinateOperation
285291
// ...
286292
break
287-
case CRS_TYPE_POINT_MOTION_OPERATION:
293+
case .TYPE_POINT_MOTION_OPERATION:
288294
let pointMotionOperation : CRSPointMotionOperation = operation as! CRSPointMotionOperation
289295
// ...
290296
break

crs-ios.podspec

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

0 commit comments

Comments
 (0)