diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index d5120d3..d14ed70 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -2,59 +2,62 @@ name: Swift on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: spm_macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: swift build - - name: Test - run: swift test + - uses: actions/checkout@v4 + - name: Build + run: swift build + - name: Test + run: swift test spm_linux: runs-on: ubuntu-latest + strategy: + matrix: + swift: ["5.9.1", "5.7.3"] container: - image: swift:5.7 + image: swift:${{ matrix.swift }} steps: - - uses: actions/checkout@v3 - - name: Build - run: swift build - - name: Test - run: swift test + - uses: actions/checkout@v4 + - name: Build + run: swift build + - name: Test + run: swift test xcode_macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: xcodebuild build -scheme GeoProjector-Package -destination 'platform=macOS' + - uses: actions/checkout@v4 + - name: Build + run: xcodebuild build -scheme GeoProjector-Package -destination 'platform=macOS' xcode_ios: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: xcodebuild build -scheme GeoProjector-Package -destination 'name=iPhone 14' -sdk iphoneos + - uses: actions/checkout@v4 + - name: Build + run: xcodebuild build -scheme GeoProjector-Package -destination 'name=iPhone 14' -sdk iphoneos cassini_macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: | - cd Examples - xcodebuild build -scheme 'Cassini' -destination 'platform=macOS' + - uses: actions/checkout@v4 + - name: Build + run: | + cd Examples + xcodebuild build -scheme 'Cassini' -destination 'platform=macOS' cassini_ios: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: | - cd Examples - xcodebuild build -scheme 'Cassini' -destination 'name=iPhone 14' -sdk iphoneos + - uses: actions/checkout@v4 + - name: Build + run: | + cd Examples + xcodebuild build -scheme 'Cassini' -destination 'name=iPhone 14' -sdk iphoneos diff --git a/Package.resolved b/Package.resolved index f7802da..8d69bd0 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/maparoni/geojsonkit-turf", "state" : { - "revision" : "7e5d8bad4bc842e27caacf0a89223c7e047fbe64", - "version" : "0.1.4" + "revision" : "21452ac7ee183930325e786575d552129c21b165", + "version" : "0.2.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser", "state" : { - "revision" : "fddd1c00396eed152c45a46bea9f47b98e59301d", - "version" : "1.2.0" + "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", + "version" : "1.2.3" } } ], diff --git a/Package.swift b/Package.swift index 33af06f..ed13990 100644 --- a/Package.swift +++ b/Package.swift @@ -5,6 +5,10 @@ import PackageDescription let package = Package( name: "GeoProjector", + platforms: [ + .macOS(.v12), .iOS(.v15), .watchOS(.v8), .tvOS(.v15), + .custom("xros", versionString: "1.0") + ], products: [ .library( name: "GeoProjector", diff --git a/Sources/GeoDrawer/GeoDrawer.swift b/Sources/GeoDrawer/GeoDrawer.swift index 2579ce3..b28dedb 100644 --- a/Sources/GeoDrawer/GeoDrawer.swift +++ b/Sources/GeoDrawer/GeoDrawer.swift @@ -128,17 +128,21 @@ public struct GeoDrawer { self.converter = { (converter($0), false) } } - let projection: Projection? + public let projection: Projection? - let size: Size + public let size: Size let zoomTo: Rect? - let insets: EdgeInsets + public let insets: EdgeInsets var invertCheck: ((GeoJSON.Polygon) -> Bool)? { projection?.invertCheck } let converter: (GeoJSON.Position) -> (Point, Bool)? + + public func point(for position: GeoJSON.Position) -> Point? { + converter(position)?.0 + } } // MARK: - Content diff --git a/Sources/GeoDrawer/GeoJSON+Continents.swift b/Sources/GeoDrawer/GeoJSON+Continents.swift index 773c4f3..83e16a1 100644 --- a/Sources/GeoDrawer/GeoJSON+Continents.swift +++ b/Sources/GeoDrawer/GeoJSON+Continents.swift @@ -20,7 +20,7 @@ import UIKit #endif extension GeoJSON.GeometryObject { - public var geometries: [GeoJSON.Geometry] { + var geometries: [GeoJSON.Geometry] { switch self { case .single(let geo): return [geo] case .multi(let geos): return geos diff --git a/Sources/GeoDrawer/GeoMap+AppKit.swift b/Sources/GeoDrawer/GeoMap+AppKit.swift index 3989bf3..18134ca 100644 --- a/Sources/GeoDrawer/GeoMap+AppKit.swift +++ b/Sources/GeoDrawer/GeoMap+AppKit.swift @@ -153,7 +153,7 @@ public struct GeoMap: NSViewRepresentable { } #if DEBUG -@available(iOS 13.0, macOS 11.0, *) +@available(iOS 13.0, visionOS 1.0, macOS 11.0, *) struct GeoMap_Previews: PreviewProvider { static var previews: some View { GeoMap( diff --git a/Sources/GeoDrawer/GeoMap+UIKit.swift b/Sources/GeoDrawer/GeoMap+UIKit.swift index 076b9f8..b9f5c7a 100644 --- a/Sources/GeoDrawer/GeoMap+UIKit.swift +++ b/Sources/GeoDrawer/GeoMap+UIKit.swift @@ -110,7 +110,7 @@ public class GeoMapView: UIView { } } -@available(iOS 13.0, *) +@available(iOS 13.0, visionOS 1.0, *) public struct GeoMap: UIViewRepresentable { public init(contents: [GeoDrawer.Content] = [], projection: Projection = Projections.Equirectangular(), zoomTo: GeoJSON.BoundingBox? = nil, insets: GeoProjector.EdgeInsets = .zero, mapBackground: UIColor? = nil, mapOutline: UIColor? = nil) { @@ -167,7 +167,7 @@ public struct GeoMap: UIViewRepresentable { } #if DEBUG -@available(iOS 13.0, macOS 11.0, *) +@available(iOS 13.0, visionOS 1.0, macOS 11.0, *) struct GeoMap_Previews: PreviewProvider { static var previews: some View { GeoMap(