Access essential data types, collections, and operating-system services to define the base layer of functionality for your app.


The Foundation framework provides a base layer of functionality for apps and frameworks, including data storage and persistence, text processing, date and time calculations, sorting and filtering, and networking. The classes, protocols, and data types defined by Foundation are used throughout the macOS, iOS, watchOS, and tvOS SDKs.



Numbers, Data, and Basic Values

Work with primitive values and other fundamental types used throughout Cocoa.

Strings and Text

Create and process strings of Unicode characters, use regular expressions to find patterns, and perform natural language analysis of text.


Use arrays, dictionaries, sets, and specialized collections to store and iterate groups of objects or values.

Dates and Times

Compare dates and times, and perform calendar and time zone calculations.

Units and Measurement

Label numeric quantities with physical dimensions to allow locale-aware formatting and conversion between related units.

Data Formatting

Convert numbers, dates, measurements, and other values to and from locale-aware string representations.

Filters and Sorting

Use predicates, expressions, and sort descriptors to examine elements in collections and other services.

App Support

Task Management

Manage your app’s work and how it interacts with system services like Handoff and Shortcuts.


Access assets and other data bundled with your app.


Design patterns for broadcasting information and for subscribing to broadcasts.

App Extension Support

Manage the interaction between an app extension and its hosting app.

Errors and Exceptions

Respond to problem situations in your interactions with APIs, and fine-tune your app for better debugging.

Scripting Support

Allow users to control your app with AppleScript and other automation technologies, or run scripts from within your app.

Files and Data Persistence

File System

Create, read, write, and examine files and folders in the file system.

Archives and Serialization

Convert objects and values to and from property list, JSON, and other flat binary representations.


Persistently store domain-scoped pieces of information used to configure your app.


Search for files and other items on the local device, and index your app's content for searching.


Manage files and key-value data that are automatically synchronized among a user's iCloud devices.


URL Loading System

Interact with URLs and communicate with servers using standard Internet protocols.


Advertise services for easy discovery on local networks, or discover services advertised by others.

Low-Level Utilities


Manage secure interprocess communication.

Object Runtime

Get low-level support for basic Objective-C features, Cocoa design patterns, and Swift integration.

Processes and Threads

Manage your app's interaction with the host operating system and other processes, and implement low-level concurrency features.

Streams, Sockets, and Ports

Use low-level Unix features to manage input and output among files, processes, and the network.


Foundation Data Types

This document describes the data types and constants found in the Foundation framework.