Foundation & UIKit & Cocoa Touch

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Foundation & UIKit & Cocoa Touch相关的知识,希望对你有一定的参考价值。

Foundation

Foundation is basically the Apple development standard library, implemented in Objective-C. It includes data types like NSArray, NSString, and NSDictionary. However, Swift provides replacements for these data types: Array, String, and Dictionary. You should only need to import Foundation in files that try to interact with Objective-C APIs. However, since all existing APIs are written in Objective-C (since Swift is so new), you will have to import Foundation in almost all files except for basic domain objects.

UIKit

UIKit actually includes Foundation. If you import UIKit, you do not need to also import Foundation. UIKit is a collection of standard APIs specific to the ios interface. It includes views like UITableView and controllers like UIViewController. You will need to important this whenever working on the UI of iOS apps.

Cocoa Touch

This template is useful for subclassing classes from UIKit and potentially having Xcode generate interface builder files for you. If you don‘t need either of those things, you should just use the Swift Class template. Only have your object inherit from NSObject if you really have to (if you need to be able to use your Swift class from Objective-C). If you don‘t inherit from NSObject, there are extra optimizations that the compiler can make and it avoids some of the slower parts of the Objective-C runtime.

以上是关于Foundation & UIKit & Cocoa Touch的主要内容,如果未能解决你的问题,请参考以下文章

iOS Foundation 框架

基础框架Fundation和UIkit框架的定义和使用

cocoa-charts 导入其依赖库TABlib 报UIKit Foundation找不到的问题

使用pch预编译文件

iOS 逆向hook的几种方法

通过自定义window来实现提示框效果