Conflicting documentation for `[UIView initWithFrame:]`: nullable or nonnull?
In the case of UIView
's -initWithFrame
initializer, the recommendation is to not defensively check the result of calling the super initializer because there is realistically nothing an application can do to recover from a failed UIView
allocation.
Also, as of Xcode 7.3 beta 4, the static analyzer no longer warns here. It now doesn't warn about returning nil from the -init
, -copy
, and -mutableCopy
families even when these methods have a return type with a nonnull
type qualifier to avoid warning on exactly this common defensive idiom.