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

21 lines
450 B
Swift
Raw Normal View History

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