From b74b32d4856579c8e44467ba23441f1ae6a8858b Mon Sep 17 00:00:00 2001 From: iBlacksus Date: Mon, 12 Dec 2022 18:09:54 +0300 Subject: [PATCH] Support iOS 11+ --- Sources/DeepLook/API/DeepLook.swift | 2 ++ Sources/DeepLook/API/Detecotor.swift | 4 +++- Sources/DeepLook/API/ImageProcessor.swift | 2 ++ Sources/DeepLook/API/Recognition.swift | 3 +++ Sources/DeepLook/Enum/TaskResult.swift | 1 + Sources/DeepLook/Extention/Operator.swift | 1 + Sources/DeepLook/ML/Actions.swift | 3 +++ Sources/DeepLook/Manager/ActionType.swift | 1 + Sources/DeepLook/Manager/Processor.swift | 1 + Sources/DeepLook/Manager/Vision.swift | 1 + Sources/DeepLook/Services/ImageFetcherService.swift | 2 +- 11 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Sources/DeepLook/API/DeepLook.swift b/Sources/DeepLook/API/DeepLook.swift index 01c6ace..c8cd900 100644 --- a/Sources/DeepLook/API/DeepLook.swift +++ b/Sources/DeepLook/API/DeepLook.swift @@ -5,8 +5,10 @@ import UIKit import Vision /// Reference to `LKRecognition.default` for quick bootstrapping and examples. +@available (iOS 13.0, *) public let DeepLook = LKDeepLook.default +@available (iOS 13.0, *) public class LKDeepLook { /// shared instance. diff --git a/Sources/DeepLook/API/Detecotor.swift b/Sources/DeepLook/API/Detecotor.swift index 3c44848..85856a3 100644 --- a/Sources/DeepLook/API/Detecotor.swift +++ b/Sources/DeepLook/API/Detecotor.swift @@ -4,8 +4,10 @@ import Foundation import UIKit /// Reference to `LKDetector.default` for quick bootstrapping and examples. +@available(iOS 13.0, *) public let Detector = LKDetector.default +@available (iOS 13.0, *) public class LKDetector { // shared instance @@ -92,7 +94,7 @@ public class LKDetector { } } - +@available (iOS 13.0, *) private extension LKDetector { func analyze( diff --git a/Sources/DeepLook/API/ImageProcessor.swift b/Sources/DeepLook/API/ImageProcessor.swift index e81c7fb..e8637bb 100644 --- a/Sources/DeepLook/API/ImageProcessor.swift +++ b/Sources/DeepLook/API/ImageProcessor.swift @@ -4,8 +4,10 @@ import Foundation import UIKit /// Reference to `LKImageProcessor.default` for quick bootstrapping and examples. +@available (iOS 13.0, *) public let ImageProcessor = LKImageProcessor.default +@available (iOS 13.0, *) public class LKImageProcessor { // shared instance diff --git a/Sources/DeepLook/API/Recognition.swift b/Sources/DeepLook/API/Recognition.swift index 2668af5..dfed115 100644 --- a/Sources/DeepLook/API/Recognition.swift +++ b/Sources/DeepLook/API/Recognition.swift @@ -4,8 +4,10 @@ import Foundation import UIKit /// Reference to `LKRecognition.default` for quick bootstrapping and examples. +@available (iOS 13.0, *) public let Recognition = LKRecognition.default +@available (iOS 13.0, *) public class LKRecognition { // shared instance @@ -252,6 +254,7 @@ public class LKRecognition { } } +@available (iOS 13.0, *) private extension LKRecognition { func groupFaces(faces: [Face], clusterOptions: ClusterOptions) -> [[Face]] { switch clusterOptions.clusterType { diff --git a/Sources/DeepLook/Enum/TaskResult.swift b/Sources/DeepLook/Enum/TaskResult.swift index 442a3f4..8962a28 100644 --- a/Sources/DeepLook/Enum/TaskResult.swift +++ b/Sources/DeepLook/Enum/TaskResult.swift @@ -1,6 +1,7 @@ // Created by Amir Lahav on 30/07/2022. // Copyright © 2019 la-labs. All rights reserved. +@available (iOS 13.0, *) public enum TaskResult: Sendable { case success(Success) case failure(Error) diff --git a/Sources/DeepLook/Extention/Operator.swift b/Sources/DeepLook/Extention/Operator.swift index 0082532..09a14f9 100644 --- a/Sources/DeepLook/Extention/Operator.swift +++ b/Sources/DeepLook/Extention/Operator.swift @@ -16,6 +16,7 @@ func |> (x: U, f: (U) throws -> T) rethrows -> T { return try f(x) } +@available (iOS 13.0, *) func |> (x: U, f: (U) async throws -> T) async rethrows -> T { return try await f(x) } diff --git a/Sources/DeepLook/ML/Actions.swift b/Sources/DeepLook/ML/Actions.swift index fc8332c..939b449 100644 --- a/Sources/DeepLook/ML/Actions.swift +++ b/Sources/DeepLook/ML/Actions.swift @@ -14,8 +14,10 @@ typealias JobPipeline = (ProcessInput) throws -> ProcessOutput typealias CustomFilter = (ProcessInput) throws -> T /// Reference to `LKActions.default` for quick bootstrapping and examples. +@available (iOS 13.0, *) public let Actions = LKActions.default +@available (iOS 13.0, *) public class LKActions { /// Models @@ -520,6 +522,7 @@ public class LKActions { } } +@available (iOS 13.0, *) private extension LKActions { func boundingBoxToRects(observation: [VNFaceObservation]) -> [CGRect] { diff --git a/Sources/DeepLook/Manager/ActionType.swift b/Sources/DeepLook/Manager/ActionType.swift index 75250ec..0f566e0 100644 --- a/Sources/DeepLook/Manager/ActionType.swift +++ b/Sources/DeepLook/Manager/ActionType.swift @@ -12,6 +12,7 @@ public extension ActionType { } } +@available (iOS 13.0, *) public extension ActionType { static var faceLocation: ActionType { .init(process: Actions.faceLocation) diff --git a/Sources/DeepLook/Manager/Processor.swift b/Sources/DeepLook/Manager/Processor.swift index 810d220..5d76703 100644 --- a/Sources/DeepLook/Manager/Processor.swift +++ b/Sources/DeepLook/Manager/Processor.swift @@ -10,6 +10,7 @@ typealias AsyncMultiplePipe = ([Input]) async throws -> [Output] typealias GenericStackProcessor = (Stack<[Input]>) async throws -> [Output] typealias StackProcessor = (Stack<[ProcessAsset]>) throws -> [ProcessAsset] +@available (iOS 13.0, *) class Processor { static func singleInputProcessor( element: Input, diff --git a/Sources/DeepLook/Manager/Vision.swift b/Sources/DeepLook/Manager/Vision.swift index fe1fd35..d6ee20e 100644 --- a/Sources/DeepLook/Manager/Vision.swift +++ b/Sources/DeepLook/Manager/Vision.swift @@ -8,6 +8,7 @@ class Vision { static let assetService = AssetService() } +@available (iOS 13.0, *) extension Vision { static func detect(objects stack: Stack<[ProcessInput]>, diff --git a/Sources/DeepLook/Services/ImageFetcherService.swift b/Sources/DeepLook/Services/ImageFetcherService.swift index 318fd17..cc9c72a 100644 --- a/Sources/DeepLook/Services/ImageFetcherService.swift +++ b/Sources/DeepLook/Services/ImageFetcherService.swift @@ -13,7 +13,7 @@ import AppKit import UIKit #endif - +@available (iOS 13.0, *) public class ImageFetcherService { private let imgManager = PHImageManager.default()