以NSObject为基类,只是为了提供Objective-C API的使用入口;

经由@object修改的对象,是这些api的参量。

NSObject是swift与oc特有机制沟通的桥梁。

Subclassing NSObject in Swift gets you Objective-C runtime flexibility but also Objective-C performance. Avoiding NSObject can improve performance if you don't need Objective-C's flexibility.

https://stackoverflow.com/questions/24057525/swift-native-base-class-or-nsobject

Before Swift 4

For example, if one subclassed from NSObject, the compiler created Objective-C entry points for all methods in such classes. The mechanism is called @objc inference.

https://stackoverflow.com/questions/44379348/the-use-of-swift-3-objc-inference-in-swift-4-mode-is-deprecated

Swift classes that are subclasses of NSObject:

  • are Objective-C classes themselves
  • use objc_msgSend() for calls to (most of) their methods
  • provide Objective-C runtime metadata for (most of) their method implementations

https://stackoverflow.com/questions/24057525/swift-native-base-class-or-nsobject

Some Objective-C APIs—like target-action—accept method or property names as parameters, then use those names to dynamically call or access the methods or properties.

https://developer.apple.com/documentation/swift/using_objective-c_runtime_features_in_swift

最新文章

  1. 简单的计算最值的MapReduce程序
  2. 解决微信OAuth2.0网页授权回调域名只能设置一个的问题
  3. svg base64
  4. android系统平台显示驱动开发简要:LCD驱动调试篇『四』
  5. 第二篇:R语言数据可视化之数据塑形技术
  6. How to face setbacks
  7. BI商业智能项目中的若干风险要素
  8. Ajax - 手册
  9. Qt之界面出现、消失动画效果
  10. iBatis多表查询
  11. ORACLE11G R2 RAC的进程启动流程
  12. [android] 服务的生命周期(混合方式)
  13. linux中查看 php.ini 的存放位置
  14. 多模块拆分时 DepencyManagement 与 Dependencys区别
  15. php一致性hash算法
  16. LOJ #2434. 「ZJOI2018」历史(LCT)
  17. 潭州课堂25班:Ph201805201 第二课:数据类型和序列类型 (课堂笔记)
  18. nodejs遇到的问题
  19. 消息队列状态:struct msqid_ds
  20. webpack window 安装loader

热门文章

  1. linux系统编程之进程(七):system()函数使用【转】
  2. 认识虚拟化(virtualization)
  3. 虚拟机C盘扩容
  4. 使用AngelaSmith.产生测试数据
  5. 从事UNIX/LInux服务器编程最方便的代码编译工具------(eclipse for c/c++)、(FileZilla)、(Secure CRT) 这三种一定要一起使用 之1
  6. NEFU 628 Garden visiting (数论)
  7. HDU 5945 Fxx and game (DP+单调队列)
  8. 【WIP】Ruby JSON
  9. 鸭子类型(Duck Typing)
  10. 51nod 1222 最小公倍数计数【莫比乌斯反演】