react-native-vision-camera/package/ios/CameraView+Focus.swift

21 lines
450 B
Swift
Raw Permalink Normal View History

2021-02-19 08:28:05 -07:00
//
// CameraView+Focus.swift
// VisionCamera
2021-02-19 08:28:05 -07:00
//
// Created by Marc Rousavy on 12.10.23.
// Copyright © 2023 mrousavy. All rights reserved.
2021-02-19 08:28:05 -07:00
//
import AVFoundation
2021-02-19 08:28:05 -07:00
import Foundation
extension CameraView {
func focus(point: CGPoint, promise: Promise) {
withPromise(promise) {
2023-11-27 06:43:56 -07:00
let normalized = previewView.captureDevicePointConverted(fromLayerPoint: point)
try cameraSession.focus(point: normalized)
return nil
2023-10-06 06:30:12 -06:00
}
}
2021-02-19 08:28:05 -07:00
}