Foundation & UIKit & Cocoa Touch

Source: Internet
Author: User

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 the only need to in files, and import Foundation interact with Objective-c APIs. However, since all existing APIs be written in objective-c (since Swift was so new) and you'll have the to import Foundation in Almost all files except for basic domain objects.

UIKit

UIKit actually includes Foundation. If you import the UIKit, you don't need to also import Foundation. UIKit is a collection for standard APIs specific to the IOS interface. It includes views like UITableView and controllers like Uiviewcontroller. You'll need to important this whenever working on the UI of IOS apps.

Cocoa Touch

This template was useful for subclassing classes from UIKit and potentially have Xcode generate interface Builder files F Or you. If you don ' t need either of those things, you should just use the Swift Class template. Only has your object inherit from NSObject if you really has to (if you need to is able to use your Swift class from OBJ ECTIVE-C). If you don ' t inherit from NSObject, there is extra optimizations that the compiler can make and it avoids some of the SLO Wer parts of the OBJECTIVE-C runtime.

Foundation & UIKit & Cocoa Touch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.