Skip to content

Commit a1ddc6f

Browse files
committed
[camera_avfoundation] Fix Swift 6 Sendability warning in CaptureDevice protocol
The `setExposureTargetBias` completion handler in the `CaptureDevice` protocol was declared as `((CMTime) -> Void)?`, while the underlying `AVCaptureDevice` conformance expects `(@sendable (CMTime) -> Void)?`. This mismatch produces a warning under `SWIFT_STRICT_CONCURRENCY=targeted` and is a hard error in Swift 6 language mode. Adds `@Sendable` to the closure parameter in the protocol declaration to match the AVFoundation signature.
1 parent 8aa6c08 commit a1ddc6f

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/camera/camera_avfoundation/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.10.1+1
2+
3+
* Fixes Swift 6 Sendability warning in `CaptureDevice` protocol by annotating
4+
the `setExposureTargetBias` completion handler as `@Sendable`.
5+
16
## 0.10.1
27

38
* Fixes fatal crash on iPhone 17 when using `ResolutionPreset.max`.

packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CaptureDevice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protocol CaptureDevice: NSObjectProtocol {
4545
var minExposureTargetBias: Float { get }
4646
var maxExposureTargetBias: Float { get }
4747
func setExposureTargetBias(
48-
_ bias: Float, completionHandler handler: ((CMTime) -> Void)?)
48+
_ bias: Float, completionHandler handler: (@Sendable (CMTime) -> Void)?)
4949
func isExposureModeSupported(_ mode: AVCaptureDevice.ExposureMode) -> Bool
5050

5151
// Zoom

packages/camera/camera_avfoundation/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_avfoundation
22
description: iOS implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.10.1
5+
version: 0.10.1+1
66

77
environment:
88
sdk: ^3.9.0

0 commit comments

Comments
 (0)