Skip to content

Commit

Permalink
Merge pull request #55 from Bersaelor/feature/update_spm
Browse files Browse the repository at this point in the history
Update dependency management to use SPM
  • Loading branch information
Bersaelor authored Jul 14, 2020
2 parents 8bfe6cf + 6803ab6 commit aee3ab2
Show file tree
Hide file tree
Showing 150 changed files with 573 additions and 9,339 deletions.
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

matrix:
include:
- os: linux
dist: trusty
sudo: required
before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
script: ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
# - os: linux
# dist: trusty
# sudo: required
# before_install:
# - git clone https://github.com/IBM-Swift/Package-Builder.git
# script:
# - ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
- os: osx
osx_image: xcode10.2
osx_image: xcode11.5
sudo: required
language: objective-c
podfile: Example/Podfile
env: TEST_DESTINATION="OS=12.2,name=iPhone X"
env: TEST_DESTINATION="OS=13.5,name=iPhone 11"
script:
- set -o pipefail && xcodebuild test -workspace Example/KDTree.xcworkspace -scheme KDTree_Example -destination "$TEST_DESTINATION" | xcpretty
- set -o pipefail && xcodebuild test -project Example/KDTree.xcodeproj -scheme KDTree_Example -resolvePackageDependencies -destination "$TEST_DESTINATION" | xcpretty
338 changes: 138 additions & 200 deletions Example/KDTree.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "SwiftyBeaver",
"repositoryURL": "https://github.com/SwiftyBeaver/SwiftyBeaver",
"state": {
"branch": null,
"revision": "e0fb3a74cb993d7dcf1e56734cdc98ad6e6d8176",
"version": "1.9.1"
}
},
{
"package": "SwiftyHYGDB",
"repositoryURL": "https://github.com/Bersaelor/SwiftyHYGDB",
"state": {
"branch": null,
"revision": "98f632f1ef7c62b9864d77f52b639a7d5193305c",
"version": "0.8.0"
}
}
]
},
"version": 1
}
10 changes: 0 additions & 10 deletions Example/KDTree.xcworkspace/contents.xcworkspacedata

This file was deleted.

20 changes: 18 additions & 2 deletions Example/KDTree/AlgorithmViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
// AlgorithmViewController.swift
// KDTree
//
// Created by Konrad Feiler on 09.04.17.
// Copyright © 2017 CocoaPods. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit

Expand Down
21 changes: 18 additions & 3 deletions Example/KDTree/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
// AppDelegate.swift
// KDTree
//
// Created by Konrad Feiler on 03/28/2016.
// Copyright (c) 2016 Konrad Feiler. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
import SwiftyBeaver

Expand Down
20 changes: 18 additions & 2 deletions Example/KDTree/IllustrationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
// IllustrationViewController.swift
// KDTree
//
// Created by Konrad Feiler on 01/04/16.
// Copyright © 2016 CocoaPods. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit

Expand Down
6 changes: 5 additions & 1 deletion Example/KDTree/StarHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// Copyright © 2017 CocoaPods. All rights reserved.
//

import Foundation
#if os(macOS)
import AppKit
#else
import UIKit
#endif
import KDTree
import SwiftyHYGDB

Expand Down
40 changes: 27 additions & 13 deletions Example/KDTree/StarMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class StarMapView: View {
var tappedPoint: CGPoint?
var centerPoint = CGPoint(x: 12.0, y: 0.0) {
didSet {
if centerPoint.x > RadialStar.ascensionRange {
centerPoint = CGPoint(x: centerPoint.x - RadialStar.ascensionRange, y: centerPoint.y)
if centerPoint.x > CGFloat(RadialStar.ascensionRange) {
centerPoint = CGPoint(x: centerPoint.x - CGFloat(RadialStar.ascensionRange), y: centerPoint.y)
} else if centerPoint.x < 0 {
centerPoint = CGPoint(x: centerPoint.x + RadialStar.ascensionRange, y: centerPoint.y)
centerPoint = CGPoint(x: centerPoint.x + CGFloat(RadialStar.ascensionRange), y: centerPoint.y)
}
if centerPoint.y > maxDeclination {
centerPoint = CGPoint(x: centerPoint.x, y: maxDeclination)
Expand Down Expand Up @@ -59,8 +59,8 @@ class StarMapView: View {
var verticalScreenRadius: CGFloat = 0.0

private func recalculatePixelRadii() {
let radiusInPxH = 0.5 * self.bounds.width / (radius * RadialStar.ascensionRange)
let radiusInPxV = 0.5 * self.bounds.width / (radius * RadialStar.declinationRange)
let radiusInPxH = 0.5 * self.bounds.width / (radius * CGFloat(RadialStar.ascensionRange))
let radiusInPxV = 0.5 * self.bounds.width / (radius * CGFloat(RadialStar.declinationRange))
pixelRadii = CGPoint(x: radiusInPxH, y: radiusInPxV)
verticalScreenRadius = self.bounds.midX / pixelRadii.x
}
Expand Down Expand Up @@ -93,6 +93,7 @@ class StarMapView: View {

func commonInit() {
#if os(macOS)
wantsLayer = true
layer?.backgroundColor = Color.black.cgColor
recalculatePixelRadii()
#else
Expand All @@ -116,20 +117,27 @@ class StarMapView: View {

func currentRadii() -> CGSize {
let aspectRatio = self.bounds.size.width / self.bounds.size.height
return CGSize(width: radius * RadialStar.ascensionRange, height: radius / aspectRatio * RadialStar.declinationRange)
return CGSize(
width: radius * CGFloat(RadialStar.ascensionRange),
height: radius / aspectRatio * CGFloat(RadialStar.declinationRange)
)
}

func skyPosition(for pointInViewCoordinates: CGPoint) -> CGPoint {
let relativeToCenter = pointInViewCoordinates - CGPoint(x: self.bounds.midX, y: self.bounds.midY)
var point = -1.0 * CGPoint(x: 1.0/pixelRadii.x, y: 1.0/pixelRadii.y) * relativeToCenter + centerPoint
if point.x < 0.0 { point = CGPoint(x: point.x + RadialStar.ascensionRange, y: point.y) }
if point.x > RadialStar.ascensionRange { point = CGPoint(x: point.x - RadialStar.ascensionRange, y: point.y) }
if point.x < 0.0 {
point = CGPoint(x: point.x + CGFloat(RadialStar.ascensionRange), y: point.y)
}
if point.x > CGFloat(RadialStar.ascensionRange) {
point = CGPoint(x: point.x - CGFloat(RadialStar.ascensionRange), y: point.y)
}
return point
}

private func pixelPosition(for positionInSky: CGPoint, radii: CGPoint, dotSize: CGFloat) -> CGPoint {
let below0h = positionInSky.x + verticalScreenRadius > RadialStar.ascensionRange && centerPoint.x < verticalScreenRadius
let over24h = positionInSky.x - verticalScreenRadius < 0 && centerPoint.x + verticalScreenRadius > RadialStar.ascensionRange
let below0h = positionInSky.x + verticalScreenRadius > CGFloat(RadialStar.ascensionRange) && centerPoint.x < verticalScreenRadius
let over24h = positionInSky.x - verticalScreenRadius < 0 && centerPoint.x + verticalScreenRadius > CGFloat(RadialStar.ascensionRange)
let adjVec = CGPoint(x: below0h ? RadialStar.ascensionRange : over24h ? -RadialStar.ascensionRange : 0, y: 0)
let starCenter = radii*(centerPoint - (positionInSky - adjVec))
return starCenter - dotSize * CGPoint(x: 0.5, y: 0.5)
Expand Down Expand Up @@ -179,14 +187,14 @@ class StarMapView: View {
let size = 12.0 * sqrt(magnification)
let attributesLbl = [NSAttributedString.Key.font: Font.systemFont(ofSize: CGFloat(size)),
NSAttributedString.Key.paragraphStyle: paragraphStyleLbl]
let relativePosition = pixelPosition(for: star.starPoint, radii: pixelRadii, dotSize: 0.0)
let relativePosition = pixelPosition(for: CGPoint(star.starPoint), radii: pixelRadii, dotSize: 0.0)
("☀️" as NSString).draw(in: CGRect(pointA: relativePosition + CGPoint(x: size, y: size),
pointB: relativePosition - CGPoint(x: size, y: size)),
withAttributes: attributesLbl)
} else {
let mag = star.starData?.value.mag ?? 0.0
let dotSize = CGFloat(StarMapView.vegaSize) * magnification / CGFloat(exp(mag * rootValue))
let relativePosition = pixelPosition(for: star.starPoint, radii: pixelRadii, dotSize: dotSize)
let relativePosition = pixelPosition(for: CGPoint(star.starPoint), radii: pixelRadii, dotSize: dotSize)
let rect = CGRect(origin: relativePosition, size: CGSize(width: dotSize, height: dotSize))
setStarColor(for: star)
context.fillEllipse(in: rect)
Expand Down Expand Up @@ -243,7 +251,7 @@ class StarMapView: View {

private func drawTapped(context: CGContext, star: RadialStar) {
let circleSize: CGFloat = 15
let relativePosition = pixelPosition(for: star.starPoint, radii: pixelRadii, dotSize: circleSize)
let relativePosition = pixelPosition(for: CGPoint(star.starPoint), radii: pixelRadii, dotSize: circleSize)
let rect: CGRect = CGRect(origin: relativePosition, size: CGSize(width: circleSize, height: circleSize))
Color.orange.setStroke()
context.setLineWidth(1.0)
Expand Down Expand Up @@ -350,3 +358,9 @@ class StarMapView: View {
return Color(red: r, green: g, blue: b, alpha: 1.0)
}
}

extension CGPoint {
init(_ floatPoint: (Float, Float)) {
self = CGPoint(x: Double(floatPoint.0), y: Double(floatPoint.1))
}
}
20 changes: 18 additions & 2 deletions Example/KDTree/TesselationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
// TesselationViewController.swift
// KDTree
//
// Created by Konrad Feiler on 03/04/16.
// Copyright © 2016 CocoaPods. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit

Expand Down
20 changes: 18 additions & 2 deletions Example/KDTree/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
// ViewController.swift
// KDTree
//
// Created by Konrad Feiler on 03/28/2016.
// Copyright (c) 2016 Konrad Feiler. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit

Expand Down
20 changes: 18 additions & 2 deletions Example/KDTree_OSX_Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
// AppDelegate.swift
// KDTree_OSX_Example
//
// Created by Konrad Feiler on 03/05/16.
// Copyright © 2016 CocoaPods. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Cocoa
import SwiftyBeaver
Expand Down
21 changes: 18 additions & 3 deletions Example/KDTree_OSX_Example/StarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
// StarViewController.swift
// KDTree
//
// Created by Konrad Feiler on 28.03.17.
// Copyright © 2017 CocoaPods. All rights reserved.
// Copyright (c) 2020 mathHeartCode UG(haftungsbeschränkt) <[email protected]>
//

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if os(macOS)
import Cocoa
#else
Expand Down
Loading

0 comments on commit aee3ab2

Please sign in to comment.