官术网_书友最值得收藏!

ARC – what is that?

Automatic Reference Counting was introduced at the 2011 WWDC, in Session 323. If you want to see the original presentation, feel free to visit https://developer.apple.com/videos/play/wwdc2011/323/

ARC is made possible by Clang and LLVM. LLVM and Clang are two technologies that enable compiling C, C++, and Objective-C code. LLVM is also used alongside the Swift compiler. With ARC, a Clang feature, developers don't have to write the tedious retain and release calls. There are multiple benefits to letting the compiler handle it, as follows:

  • Memory management is difficult
  • The compiler is often more correct than you are
  • There are fewer lines of code to write
  • It has the same performance as manual reference counting

With Swift being a modern language and the successor of Objective-C, you've never had to call retain. Swift programs leverage ARC, in order to simplify memory management. In Swift, there are multiple memory management concepts to master, and we'll cover them in this section.

主站蜘蛛池模板: 依兰县| 六枝特区| 阿克陶县| 玛沁县| 贵德县| 华亭县| 溆浦县| 仙居县| 高邑县| 瓮安县| 北海市| 湖州市| 天津市| 上林县| 榆树市| 尼玛县| 永顺县| 高尔夫| 九江市| 宽甸| 洪江市| 娄烦县| 固始县| 芒康县| 永善县| 哈巴河县| 江陵县| 白朗县| 景泰县| 恩施市| 德格县| 柯坪县| 焦作市| 周宁县| 鹤山市| 眉山市| 沂南县| 铁岭市| 绥中县| 东海县| 抚顺市|