Skip to content

Commit

Permalink
added Package.swift, minimum version is now ios 11
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxfrazer committed Jun 20, 2019
1 parent c2a84b2 commit 9e770e4
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 11 deletions.
25 changes: 25 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SCNPath",
platforms: [
.iOS(.v11)
],
products: [
.library(
name: "SCNPath",
targets: ["SCNPath"]),
],
targets: [
// No tests created just yet.
.target(
name: "SCNPath",
dependencies: []),
.testTarget(
name: "SCNPathTests",
dependencies: ["SCNPath"]),
]
)
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# ARKit-SCNPath

Functions and classes for creating path geometries in a SceneKit application on iOS. Main use-case being for ARKit.

I'm hoping to add RealityKit support once it is possible to generate meshes. (If anyone knows a way how, please let me know!)

[![Version](https://img.shields.io/cocoapods/v/SCNPath.svg)](https://cocoapods.org/pods/SCNPath)
[![License](https://img.shields.io/cocoapods/l/SCNPath.svg)](https://cocoapods.org/pods/SCNPath)
[![Platform](https://img.shields.io/cocoapods/p/SCNPath.svg)](https://cocoapods.org/pods/SCNPath)
[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-v1.2.0-orange.svg?style=flat)](https://github.com/apple/swift-package-manager)
[![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat)](https://swift.org/)
[![Build Status](https://travis-ci.com/maxxfrazer/ARKit-SCNPath.svg?branch=master)](https://travis-ci.com/maxxfrazer/ARKit-SCNPath)

Expand All @@ -18,25 +19,33 @@ Navigation seems to be a strong point for people making AR apps. So here's a cla
Please feel free to use and contribute this library however you like.
I only ask that you let me know when you're doing so, so I can see some cool uses of it!

## Requirements
- Swift 5.0
- iOS 11.0

## Compatability
- [x] SceneKit
- [ ] RealityKit

## Example

It's as easy as this to make a node with this path as a geometry:

```
let pathNode = SCNPathNode(path: [
SCNVector3(0,-1,0),
SCNVector3(0,-1,-1),
SCNVector3(1,-1,-1)
SCNVector3(0, -1, 0),
SCNVector3(0, -1, -1),
SCNVector3(1, -1, -1)
])
```

Alternatively, you can grab the geometry directly:

```
let pathGeometry = SCNGeometry.path(path: [
SCNVector3(0,-1,0),
SCNVector3(0,-1,-1),
SCNVector3(1,-1,-1)
SCNVector3(0, -1, 0),
SCNVector3(0, -1, -1),
SCNVector3(1, -1, -1)
])
```

Expand Down
6 changes: 3 additions & 3 deletions SCNPath.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "SCNPath"
s.version = "1.1.0"
s.version = "1.2.0"
s.summary = "SCNPath lets you create paths for any purpose in AR using just centre points for your path."
s.homepage = "https://github.com/maxxfrazer/ARKit-SCNPath"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Max Cobb" => "maxxc@mac.com" }
s.source = { :git => "https://github.com/maxxfrazer/ARKit-SCNPath.git", :tag => "#{s.version}" }
s.platform = :ios, '12.0'
s.platform = :ios, '11.0'
s.swift_version = '5.0'
s.frameworks = 'SceneKit'
s.source_files = "SCNPath/*.swift", ".swiftlint.yml"
s.source_files = "Sources/SCNPath/*.swift", ".swiftlint.yml"
end
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ public extension SCNGeometry {
materials.append(SCNGeometry.defaultSCNPathMaterial)
}
if curveDistance < 1 {
os_log(.error, "curve distance is too low, minimum value is 1")
if #available(iOS 12.0, *) {
os_log(.error, "curve distance is too low, minimum value is 1")
} else {
fatalError("curve distance is too low, minimum value is 1")
}
}
let curveDistance = max(curveDistance, 1)
var vertices: [SCNVector3] = []
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions Tests/SCNPathTests/SCNPathTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import XCTest
@testable import ARKit_SCNPath

final class ARKit_SCNPathTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 9 additions & 0 deletions Tests/SCNPathTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(ARKit_SCNPathTests.allTests),
]
}
#endif

0 comments on commit 9e770e4

Please sign in to comment.