Skip to content

Update NS_ENUM and Add Swift Package Manager Support #14

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 9 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.

9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches-ignore:
- master
pull_request:

jobs:

Expand All @@ -13,8 +14,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-wkb-ios.xcworkspace -scheme sf-wkb-ios -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14'
run: swift build
- name: Test
run: swift test
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Adheres to [Semantic Versioning](http://semver.org/).

---

## 4.1.5 (TBD)
## 5.0.0 (5-6-2025)

* TBD
* Integrates sf-ios 5.0.0 (SimpleFeatures) breaking code chanegs for NS_ENUM.
* Updates existing enums to NS_ENUM for Swift for Objective-C interoperability.
* Adds Swift Package support and removes Cocoapods support (since it's deprecated).

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

Expand Down
15 changes: 15 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"originHash" : "895c3e47845b43751f9a634840b8164ed939509f3eae79dc8342a2581e74d2e7",
"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: "SimpleFeaturesWKB",
platforms: [.macOS(.v11), .iOS(.v13)],
products: [
.library(
name: "SimpleFeaturesWKB",
targets: ["SimpleFeaturesWKB"]),
],
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: "SimpleFeaturesWKB",
dependencies: [
.product(name: "SimpleFeatures", package: "simple-features-ios")
],
path: "sf-wkb-ios",
publicHeadersPath: "include"
),
.testTarget(
name: "SimpleFeaturesWKBTests",
dependencies: [
"SimpleFeaturesWKB",
"TestUtils"
],
path: "sf-wkb-iosTests"
),
.testTarget(
name: "SimpleFeaturesWKBTestsSwift",
dependencies: [
"SimpleFeaturesWKB",
"TestUtils"
],
path: "sf-wkb-iosTests-swift"
),
.target(
name: "TestUtils", // Shared test code
dependencies: ["SimpleFeaturesWKB"],
path: "TestUtils",
publicHeadersPath: ""
),
]
)
6 changes: 4 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'
platform :ios, '15.0'

target 'sf-wkb-ios' do
pod 'sf-ios', '~> 4.1.4'
# pod 'sf-ios', '5.0.0'
pod 'sf-ios', :git => 'https://github.com/ngageoint/simple-features-ios.git', :branch => 'psolt/v5-NS_ENUM'


target 'sf-wkb-iosTests' do
inherit! :search_paths
Expand Down
43 changes: 24 additions & 19 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-wkb-ios/do
// NSData *data = ...

SFGeometry *geometry = [SFWBGeometryReader readGeometryWithData:data];
enum SFGeometryType geometryType = geometry.geometryType;
SFGeometryType geometryType = geometry.geometryType;

```

Expand All @@ -40,44 +40,49 @@ NSData *data = [SFWBGeometryWriter writeGeometry:geometry];

### Build ###

[![Build & Test](https://github.com/ngageoint/simple-features-wkb-ios/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/simple-features-wkb-ios/actions/workflows/build-test.yml)
[![Build](https://github.com/ngageoint/simple-features-wkb-ios/actions/workflows/build.yml/badge.svg)](https://github.com/ngageoint/simple-features-wkb-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-wkb-ios.xcworkspace in Xcode or build from command line:
Open the Swift Package in Xcode:

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

Run tests from Xcode or from command line:

xcodebuild test -workspace 'sf-wkb-ios.xcworkspace' -scheme sf-wkb-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-wkb-ios):
.package(url: "https://github.com/ngageoint/simple-features-wkb-ios", from: "5.0.0"),

pod 'sf-wkb-ios', '~> 4.1.4'
# Or specific branch:

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

# Or as a local dependency:

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

Include as local project:
Use it in a target:

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

### Swift ###

To use from Swift, import the sf-wkb-ios bridging header from the Swift project's bridging header

#import "sf-wkb-ios-Bridging-Header.h"
To use from Swift, import the framework:

import SimpleFeaturesWKB

#### Read ####

```swift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
// Copyright © 2015 NGA. All rights reserved.
//

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

@interface SFWBGeometryTestUtils : NSObject

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

@import XCTest;
@import SimpleFeatures;
@import SimpleFeaturesWKB;

#import "SFWBGeometryTestUtils.h"
#import "SFWBTestUtils.h"
#import "SFByteWriter.h"
#import "SFWBGeometryWriter.h"
#import "SFWBGeometryReader.h"
#import "SFWBGeometryCodes.h"

@implementation SFWBGeometryTestUtils

Expand Down Expand Up @@ -64,7 +64,7 @@ +(void) compareGeometriesWithExpected: (SFGeometry *) expected andActual: (SFGeo
}else{
[SFWBTestUtils 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 @@ -120,15 +120,16 @@ +(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];
}
}

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

+(void) compareBaseGeometryAttributesWithExpected: (SFGeometry *) expected andActual: (SFGeometry *) actual{
[SFWBTestUtils assertEqualIntWithValue:expected.geometryType andValue2:actual.geometryType];
XCTAssertEqual(expected.geometryType, actual.geometryType);

[SFWBTestUtils assertEqualBoolWithValue:expected.hasZ andValue2:actual.hasZ];
[SFWBTestUtils assertEqualBoolWithValue:expected.hasM andValue2:actual.hasM];
[SFWBTestUtils assertEqualIntWithValue:[SFWBGeometryCodes codeFromGeometry:expected] andValue2:[SFWBGeometryCodes codeFromGeometry:actual]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 NGA. All rights reserved.
//

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

@interface SFWBTestUtils : NSObject

Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions sf-wkb-ios.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'sf-wkb-ios'
s.version = '4.1.5'
s.version = '5.0.0'
s.license = {:type => 'MIT', :file => 'LICENSE' }
s.summary = 'iOS SDK for Simple Features Well-Known Binary'
s.homepage = 'https://github.com/ngageoint/simple-features-wkb-ios'
Expand All @@ -13,9 +13,10 @@ Pod::Spec.new do |s|
s.platform = :ios, '12.0'
s.ios.deployment_target = '12.0'

s.source_files = 'sf-wkb-ios/**/*.{h,m}'
s.source_files = 'sf-wkb-ios/**/*.{m}'
s.public_header_files = 'sf-wkb-ios/**/*.h'

s.frameworks = 'Foundation'

s.dependency 'sf-ios', '~> 4.1.4'
s.dependency 'sf-ios', '5.0.0'
end
Loading