Maybe we should treat force unwrpping as same as optional ?
Code:
@available(iOS 16.0, *)
@AssociatedObject(.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
private var interaction: ImageAnalysisInteraction! = .init()
Expanded:
{
get {
if !self.__associated_interactionIsSet {
let value: ImageAnalysisInteraction! = .init()
objc_setAssociatedObject(
self,
Self.__associated_interactionKey,
value,
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
)
self.__associated_interactionIsSet = true
return value
} else {
return objc_getAssociatedObject(
self,
Self.__associated_interactionKey
) as! ImageAnalysisInteraction // <-- This force unwrapping will crash if value is nil.
}
}
set {
objc_setAssociatedObject(
self,
Self.__associated_interactionKey,
newValue,
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
)
}
}
Maybe we should treat
force unwrpping
as same asoptional
?Code:
Expanded: