Friday, November 22, 2013

IBOutlets as Weak References

Zach Drayer:

When using Interface Builder and code, you have IBOutlets. If your project is ARC, the IBOutlets generated are `weak`. This is problematic because if you turn on CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK and CLANG_WARN_OBJC_RECEIVER_WEAK to try and catch bugs, you run into dozens/hundreds/thousands of warnings in your project. While it is nice to have your code as correct as possible, seeing thousands of warnings is enough to greatly sadden pretty much anyone.

The compiler wants you to make a strong reference before each use, which is not really necessary if you know that the owner of the references isn’t going anywhere.

Comments RSS · Twitter

Leave a Comment