focusRectOfInterest
The device’s current focus rectangle of interest, if it has one.
Declaration
var focusRectOfInterest: CGRect { get set }Discussion
The value of this property is a CGRect determining the device’s focus rectangle of interest. Use this as an alternative to setting focusPointOfInterest, as it allows you to specify both a location and size. For example, a value of CGRectMake(0, 0, 1, 1) tells the device to use the entire field of view when determining the focus, while CGRectMake(0, 0, 0.25, 0.25) indicates the top left sixteenth, and CGRectMake(0.75, 0.75, 0.25, 0.25) indicates the bottom right sixteenth. Setting focusRectOfInterest throws an NSInvalidArgumentException if isFocusRectOfInterestSupported returns false. Setting focusRectOfInterest throws an NSInvalidArgumentException if your provided rectangle’s size is smaller than the minFocusRectOfInterestSize. Setting focusRectOfInterest throws an NSGenericException if you call it without first obtaining exclusive access to the device using lockForConfiguration(). Setting focusRectOfInterest updates the device’s focusPointOfInterest to the center of your provided rectangle of interest. If you later set the device’s focusPointOfInterest, the focusRectOfInterest resets to the default sized rectangle of interest for the new focus point of interest. If you change your activeFormat, the point of interest and rectangle of interest both revert to their default values. You can observe automatic changes to the device’s focusRectOfInterest by key-value observing this property.