Skip to content

Update NS_ENUM and Add Swift Package Manager Support #2

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/build-test.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install
run: pod install
uses: actions/checkout@v4
- name: Build
run: xcodebuild build-for-testing -workspace sf-wkt-ios.xcworkspace -scheme sf-wkt-ios -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14'
run: swift build
- name: Test
run: swift test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Pods
xcuserdata/
*.swp
Carthage/
.build/
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Adheres to [Semantic Versioning](http://semver.org/).

---

## 2.1.5 (TBD)

* TBD
## 3.0.0 (5-6-2025)
* Breaking changes for Swift interopability. Converted C `enum` types to Objective-C `NS_ENUM` for proper visibility in Swift.
* SimpleFeatures (sf-ios) 5.0.0 with NS_ENUM support for Objective-C and Swift interoperability.
* Adds Swift Package Manager (SPM) support and removes Cocoapods and Carthage

## [2.1.4](https://github.com/ngageoint/simple-features-wkt-ios/releases/tag/2.1.4) (04-08-2024)

Expand Down
Empty file removed Cartfile
Empty file.
Empty file removed Cartfile.resolved
Empty file.
15 changes: 15 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"originHash" : "d2d9973597ce4fa8ad140762a1b8a340830f1004e00b0d72b609a362cde8b853",
"pins" : [
{
"identity" : "simple-features-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ngageoint/simple-features-ios",
"state" : {
"branch" : "psolt/v5-NS_ENUM_Package",
"revision" : "7672b0950afa0fe7d9b26b5b369c33161b13b387"
}
}
],
"version" : 3
}
49 changes: 49 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// swift-tools-version: 5.10

import PackageDescription

let package = Package(
name: "SimpleFeaturesWKT",
platforms: [.macOS(.v11), .iOS(.v13)],
products: [
.library(
name: "SimpleFeaturesWKT",
targets: ["SimpleFeaturesWKT"]),
],
dependencies: [
.package(url: "https://github.com/ngageoint/simple-features-ios", branch: "psolt/v5-NS_ENUM_Package"),
// FIXME: Update to published release (5.0.0 version)
],
targets: [
.target(
name: "SimpleFeaturesWKT",
dependencies: [
.product(name: "SimpleFeatures", package: "simple-features-ios")
],
path: "sf-wkt-ios",
publicHeadersPath: "include"
),
.testTarget(
name: "SimpleFeaturesWKTTests",
dependencies: [
"SimpleFeaturesWKT",
"TestUtils"
],
path: "sf-wkt-iosTests"
),
.testTarget(
name: "SimpleFeaturesWKTTestsSwift",
dependencies: [
"SimpleFeaturesWKT",
"TestUtils"
],
path: "sf-wkt-iosTests-swift"
),
.target(
name: "TestUtils", // Shared test code
dependencies: ["SimpleFeaturesWKT"],
path: "TestUtils",
publicHeadersPath: ""
),
]
)
10 changes: 0 additions & 10 deletions Podfile

This file was deleted.

41 changes: 23 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ View the latest [Appledoc](http://ngageoint.github.io/simple-features-wkt-ios/do
// NSString *text = ...

SFGeometry *geometry = [SFWTGeometryReader readGeometryWithText:text];
enum SFGeometryType geometryType = geometry.geometryType;
SFGeometryType geometryType = geometry.geometryType;

```

Expand All @@ -40,43 +40,48 @@ NSString *text = [SFWTGeometryWriter writeGeometry:geometry];

### Build ###

[![Build & Test](https://github.com/ngageoint/simple-features-wkt-ios/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/simple-features-wkt-ios/actions/workflows/build-test.yml)
[![Build](https://github.com/ngageoint/simple-features-wkt-ios/actions/workflows/build.yml/badge.svg)](https://github.com/ngageoint/simple-features-wkt-ios/actions/workflows/build.yml)

Build this repository using Xcode and/or CocoaPods:
Build this repository using SPM:

pod repo update
pod install
swift build

Open sf-wkt-ios.xcworkspace in Xcode or build from command line:
Open the Swift Package in Xcode:

xcodebuild -workspace 'sf-wkt-ios.xcworkspace' -scheme sf-wkt-ios build
open Package.swift

Run tests from Xcode or from command line:

xcodebuild test -workspace 'sf-wkt-ios.xcworkspace' -scheme sf-wkt-ios -destination 'platform=iOS Simulator,name=iPhone 15'
swift test

### Include Library ###

Include this repository by specifying it in a Podfile using a supported option.
Add a package dependency version:

Pull from [CocoaPods](https://cocoapods.org/pods/sf-wkt-ios):
.package(url: "https://github.com/ngageoint/simple-features-wkt-ios", from: "3.0.0"),

pod 'sf-wkt-ios', '~> 2.1.4'
# Or specific branch:

Pull from GitHub:
.package(url: "https://github.com/ngageoint/simple-features-wkt-ios", branch: "release/3.0.0"),

# Or as a local dependency:

pod 'sf-wkt-ios', :git => 'https://github.com/ngageoint/simple-features-wkt-ios.git', :branch => 'master'
pod 'sf-wkt-ios', :git => 'https://github.com/ngageoint/simple-features-wkt-ios.git', :tag => '2.1.4'
.package(name: "simple-features-wkt-ios", path: "../simple-features-wkt-ios"),

Include as local project:
Use it in a target:

pod 'sf-wkt-ios', :path => '../simple-features-wkt-ios'
.target(
name: "MyLibrary",
dependencies: [
.product(name: "SimpleFeaturesWKT", package: "simple-features-wkt-ios")
]
)

### Swift ###

To use from Swift, import the sf-wkt-ios bridging header from the Swift project's bridging header
To use from Swift, import the framework:

#import "sf-wkt-ios-Bridging-Header.h"
import SimpleFeaturesWKT

#### Read ####

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
// Copyright © 2020 NGA. All rights reserved.
//

#import "SFMultiPoint.h"
#import "SFCircularString.h"
#import "SFCompoundCurve.h"
#import "SFTIN.h"
#import "SFTriangle.h"
@import Foundation;
@import SimpleFeatures;

@interface SFWTGeometryTestUtils : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// Copyright © 2020 NGA. All rights reserved.
//

@import XCTest;
@import SimpleFeaturesWKT;

#import "SFWTGeometryTestUtils.h"
#import "SFWTTestUtils.h"
#import "SFWTGeometryWriter.h"
#import "SFWTGeometryReader.h"

@implementation SFWTGeometryTestUtils

Expand Down Expand Up @@ -62,7 +63,7 @@ +(void) compareGeometriesWithExpected: (SFGeometry *) expected andActual: (SFGeo
}else{
[SFWTTestUtils assertNotNil:actual];

enum SFGeometryType geometryType = expected.geometryType;
SFGeometryType geometryType = expected.geometryType;
switch(geometryType){
case SF_GEOMETRY:
[NSException raise:@"Unexpected Geometry Type" format:@"Unexpected Geometry Type of %@ which is abstract", [SFGeometryTypes name:geometryType]];
Expand Down Expand Up @@ -118,15 +119,15 @@ +(void) compareGeometriesWithExpected: (SFGeometry *) expected andActual: (SFGeo
[self compareTriangleWithExpected:(SFTriangle *)expected andActual:(SFTriangle *)actual andDelta:delta];
break;
default:
[NSException raise:@"Geometry Type Not Supported" format:@"Geometry Type not supported: %d", geometryType];
[NSException raise:@"Geometry Type Not Supported" format:@"Geometry Type not supported: %ld", geometryType];
}
}

//[SFWTTestUtils assertEqualWithValue:expected andValue2:actual];
}

+(void) compareBaseGeometryAttributesWithExpected: (SFGeometry *) expected andActual: (SFGeometry *) actual{
[SFWTTestUtils assertEqualIntWithValue:expected.geometryType andValue2:actual.geometryType];
XCTAssertEqual(expected.geometryType, actual.geometryType);
[SFWTTestUtils assertEqualBoolWithValue:expected.hasZ andValue2:actual.hasZ];
[SFWTTestUtils assertEqualBoolWithValue:expected.hasM andValue2:actual.hasM];
}
Expand Down Expand Up @@ -317,7 +318,7 @@ +(SFGeometry *) readGeometryWithText: (NSString *) text andValidateZM: (BOOL) va

SFTextReader *reader = [[SFTextReader alloc] initWithText:text];
SFWTGeometryTypeInfo *geometryTypeInfo = [SFWTGeometryReader readGeometryTypeWithReader:reader];
enum SFGeometryType expectedGeometryType = [geometryTypeInfo geometryType];
SFGeometryType expectedGeometryType = [geometryTypeInfo geometryType];
switch (expectedGeometryType) {
case SF_MULTICURVE:
case SF_MULTISURFACE:
Expand All @@ -326,7 +327,7 @@ +(SFGeometry *) readGeometryWithText: (NSString *) text andValidateZM: (BOOL) va
default:
break;
}
[SFWTTestUtils assertEqualIntWithValue:expectedGeometryType andValue2:geometry.geometryType];
XCTAssertEqual(expectedGeometryType, geometry.geometryType);
if(validateZM){
[SFWTTestUtils assertEqualBoolWithValue:[geometryTypeInfo hasZ] andValue2:geometry.hasZ];
[SFWTTestUtils assertEqualBoolWithValue:[geometryTypeInfo hasM] andValue2:geometry.hasM];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2020 NGA. All rights reserved.
//

#import <Foundation/Foundation.h>
@import Foundation;

@interface SFWTTestUtils : NSObject

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xcodebuild -workspace 'sf-wkt-ios.xcworkspace' -scheme sf-wkt-ios build

Xcode Test:

xcodebuild test -workspace 'sf-wkt-ios.xcworkspace' -scheme sf-wkt-ios -destination 'platform=iOS Simulator,name=iPhone 15'
xcodebuild test -workspace 'sf-wkt-ios.xcworkspace' -scheme sf-wkt-ios -destination 'platform=iOS Simulator,name=iPhone 16'

CocoaPods Local Lint:

Expand Down
21 changes: 0 additions & 21 deletions sf-wkt-ios.podspec

This file was deleted.

Loading