Skip to content

Commit

Permalink
Merge pull request #145 from Jeehut/main
Browse files Browse the repository at this point in the history
Add support for adding this lib to multi-platform targets
  • Loading branch information
nathanfallet committed May 31, 2024
2 parents 944a6a1 + f3586ac commit 23e9b6e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 27 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@ on:

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Show eligible build destinations
run: xcodebuild -showdestinations -scheme CodeScanner
- name: Build ( iOS)
run: xcodebuild build -scheme CodeScanner -destination 'platform=iOS Simulator,OS=latest,name=iPhone 13 Pro'
- name: Build ( visionOS)
run: xcodebuild build -scheme CodeScanner -destination 'platform=visionOS Simulator,OS=latest,name=Apple Vision Pro'
- name: Build ( mac Catalyst)
run: xcodebuild build -scheme CodeScanner -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst'
28 changes: 5 additions & 23 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

// swift-tools-version:5.9
import PackageDescription

let package = Package(
name: "CodeScanner",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "CodeScanner",
targets: ["CodeScanner"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "CodeScanner",
dependencies: []),
]
platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .visionOS(.v1), .watchOS(.v6)],
products: [.library(name: "CodeScanner", targets: ["CodeScanner"])],
dependencies: [],
targets: [.target(name: "CodeScanner", dependencies: [])]
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 Paul Hudson. All rights reserved.
//

#if os(iOS)
import AVFoundation

@available(macCatalyst 14.0, *)
Expand Down Expand Up @@ -79,6 +80,7 @@ private extension Float {
self * Float.pi / 180
}
}
#endif

/*
Part of this code is copied from Apple sample project "AVCamBarcode: Using AVFoundation to capture barcodes".
Expand Down
2 changes: 2 additions & 0 deletions Sources/CodeScanner/CodeScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2021 Paul Hudson. All rights reserved.
//

#if os(iOS)
import AVFoundation
import SwiftUI

Expand Down Expand Up @@ -153,3 +154,4 @@ struct CodeScannerView_Previews: PreviewProvider {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/CodeScanner/ScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2021 Paul Hudson. All rights reserved.
//

#if os(iOS)
import AVFoundation
import UIKit

Expand Down Expand Up @@ -594,3 +595,4 @@ public extension AVCaptureDevice {
}

}
#endif

0 comments on commit 23e9b6e

Please sign in to comment.