<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/foundation-data-types",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Foundation Data Types"
}
-->

# Foundation Data Types

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

## Topics

### Classes

[`@interface NSConstantString : NSSimpleCString`](/documentation/Foundation/NSConstantString)

[`class NSKeyValueObservation`](/documentation/Foundation/NSKeyValueObservation)

[`class NSKeyValueSharedObservers`](/documentation/Foundation/NSKeyValueSharedObservers)

A collection of key-value observations which may be registered with multiple
observable objects

[`class NSKeyValueSharedObserversSnapshot`](/documentation/Foundation/NSKeyValueSharedObserversSnapshot)

A collection of key-value observations which may be registered with multiple
observable objects. Create using `-[NSKeyValueSharedObservers snapshot]`

[`@interface NSLocalizedNumberFormatRule : NSObject`](/documentation/Foundation/NSLocalizedNumberFormatRule)

[`@interface NSSimpleCString : NSString`](/documentation/Foundation/NSSimpleCString)

### Protocols

[`protocol DiscreteFormatStyle`](/documentation/Foundation/DiscreteFormatStyle)

A format style that transforms a continuous input into a discrete output and provides
information about its discretization boundaries.

[`protocol NSKeyValueObservingCustomization`](/documentation/Foundation/NSKeyValueObservingCustomization)

Conforming to NSKeyValueObservingCustomization is not required to use Key-Value Observing. Provide an implementation of these functions if you need to disable auto-notifying for a key, or add dependent keys

### Structures

[`struct AsyncCharacterSequence`](/documentation/Foundation/AsyncCharacterSequence)

An asynchronous sequence of characters.

[`struct AsyncLineSequence`](/documentation/Foundation/AsyncLineSequence)

An asynchronous sequence of lines of text.

[`struct AsyncUnicodeScalarSequence`](/documentation/Foundation/AsyncUnicodeScalarSequence)

An asychronous sequence of Unicode scalar values.

[`struct Expression`](/documentation/Foundation/Expression)

[`struct NSAttributedStringFormattingContextKey`](/documentation/Foundation/NSAttributedStringFormattingContextKey)

A type that represents a key in the formatting context dictionary.

[`struct NSKeyValueChangeKey`](/documentation/Foundation/NSKeyValueChangeKey)

The keys that can appear in the change dictionary.

[`struct NSKeyValueObservedChange`](/documentation/Foundation/NSKeyValueObservedChange)

[`struct NSKeyValueOperator`](/documentation/Foundation/NSKeyValueOperator)

These constants define the available array operators. See [Using Collection Operators](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/CollectionOperators.html) for more information.

[`struct PresentationIntent`](/documentation/Foundation/PresentationIntent)

A type that defines presentation intent for blocks of characters like paragraphs, lists, block quotes, and tables.

### Variables

[`let NSOperationNotSupportedForKeyException: String`](/documentation/Foundation/NSOperationNotSupportedForKeyException)

[`let NSURLSessionUploadTaskResumeData: String`](/documentation/Foundation/NSURLSessionUploadTaskResumeData)

Key in the userInfo dictionary of an NSError received during a failed upload.

[`var kCFStringEncodingASCII: CFStringEncoding`](/documentation/Foundation/kCFStringEncodingASCII)

### Macros

[`macro Expression<each Input, Output>((repeat each Input) -> Output) -> Expression<repeat each Input, Output>`](/documentation/Foundation/Expression(_:))

[`macro Predicate<each Input>((repeat each Input) -> Bool) -> Predicate<repeat each Input>`](/documentation/Foundation/Predicate(_:))

[`#define ABS(A)`](/documentation/Foundation/ABS)

[`#define FOUNDATION_EXPORT`](/documentation/Foundation/FOUNDATION_EXPORT)

[`#define FOUNDATION_EXTERN`](/documentation/Foundation/FOUNDATION_EXTERN)

[`#define FOUNDATION_EXTERN_INLINE`](/documentation/Foundation/FOUNDATION_EXTERN_INLINE)

[`#define FOUNDATION_IMPORT`](/documentation/Foundation/FOUNDATION_IMPORT)

[`#define FOUNDATION_STATIC_INLINE`](/documentation/Foundation/FOUNDATION_STATIC_INLINE)

[`#define FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST(__epoch__)`](/documentation/Foundation/FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST)

[`#define MAX(A, B)`](/documentation/Foundation/MAX)

[`#define MIN(A, B)`](/documentation/Foundation/MIN)

[`#define NS_ASSUME_NONNULL_BEGIN`](/documentation/Foundation/NS_ASSUME_NONNULL_BEGIN)

[`#define NS_ASSUME_NONNULL_END`](/documentation/Foundation/NS_ASSUME_NONNULL_END)

[`#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE`](/documentation/Foundation/NS_AUTOMATED_REFCOUNT_UNAVAILABLE)

[`#define NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE`](/documentation/Foundation/NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE)

[`#define NS_AVAILABLE(_mac, _ios)`](/documentation/Foundation/NS_AVAILABLE)

[`#define NS_AVAILABLE_IOS(_ios)`](/documentation/Foundation/NS_AVAILABLE_IOS)

[`#define NS_AVAILABLE_IPHONE(_ios)`](/documentation/Foundation/NS_AVAILABLE_IPHONE)

[`#define NS_AVAILABLE_MAC(_mac)`](/documentation/Foundation/NS_AVAILABLE_MAC)

[`#define NS_BLOCKS_AVAILABLE`](/documentation/Foundation/NS_BLOCKS_AVAILABLE)

[`#define NS_CALENDAR_DEPRECATED(A, B, C, D, ...)`](/documentation/Foundation/NS_CALENDAR_DEPRECATED)

[`#define NS_CALENDAR_DEPRECATED_MAC(A, B, ...)`](/documentation/Foundation/NS_CALENDAR_DEPRECATED_MAC)

[`#define NS_CALENDAR_ENUM_DEPRECATED(A, B, C, D, ...)`](/documentation/Foundation/NS_CALENDAR_ENUM_DEPRECATED)

[`#define NS_CLASS_AVAILABLE(_mac, _ios)`](/documentation/Foundation/NS_CLASS_AVAILABLE)

[`#define NS_CLASS_AVAILABLE_IOS(_ios)`](/documentation/Foundation/NS_CLASS_AVAILABLE_IOS)

[`#define NS_CLASS_AVAILABLE_MAC(_mac)`](/documentation/Foundation/NS_CLASS_AVAILABLE_MAC)

[`#define NS_CLASS_DEPRECATED(_mac, _macDep, _ios, _iosDep, ...)`](/documentation/Foundation/NS_CLASS_DEPRECATED)

[`#define NS_CLASS_DEPRECATED_IOS(_iosIntro, _iosDep, ...)`](/documentation/Foundation/NS_CLASS_DEPRECATED_IOS)

[`#define NS_CLASS_DEPRECATED_MAC(_macIntro, _macDep, ...)`](/documentation/Foundation/NS_CLASS_DEPRECATED_MAC)

[`#define NS_CLOSED_ENUM(_type, _name)`](/documentation/Foundation/NS_CLOSED_ENUM)

[`#define NS_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep, ...)`](/documentation/Foundation/NS_DEPRECATED)

[`#define NS_DEPRECATED_IOS(_iosIntro, _iosDep, ...)`](/documentation/Foundation/NS_DEPRECATED_IOS)

[`#define NS_DEPRECATED_IPHONE(_iosIntro, _iosDep)`](/documentation/Foundation/NS_DEPRECATED_IPHONE)

[`#define NS_DEPRECATED_MAC(_macIntro, _macDep, ...)`](/documentation/Foundation/NS_DEPRECATED_MAC)

[`#define NS_DEPRECATED_WITH_REPLACEMENT_MAC(_rep, _macIntroduced, _macDeprecated)`](/documentation/Foundation/NS_DEPRECATED_WITH_REPLACEMENT_MAC)

[`#define NS_ENUM(...)`](/documentation/Foundation/NS_ENUM)

[`#define NS_ENUM_AVAILABLE(_mac, _ios)`](/documentation/Foundation/NS_ENUM_AVAILABLE)

[`#define NS_ENUM_AVAILABLE_IOS(_ios)`](/documentation/Foundation/NS_ENUM_AVAILABLE_IOS)

[`#define NS_ENUM_AVAILABLE_MAC(_mac)`](/documentation/Foundation/NS_ENUM_AVAILABLE_MAC)

[`#define NS_ENUM_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep, ...)`](/documentation/Foundation/NS_ENUM_DEPRECATED)

[`#define NS_ENUM_DEPRECATED_IOS(_iosIntro, _iosDep, ...)`](/documentation/Foundation/NS_ENUM_DEPRECATED_IOS)

[`#define NS_ENUM_DEPRECATED_MAC(_macIntro, _macDep, ...)`](/documentation/Foundation/NS_ENUM_DEPRECATED_MAC)

[`#define NS_ERROR_ENUM(...)`](/documentation/Foundation/NS_ERROR_ENUM)

[`#define NS_EXTENSIBLE_STRING_ENUM`](/documentation/Foundation/NS_EXTENSIBLE_STRING_ENUM)

[`#define NS_EXTENSION_UNAVAILABLE(_msg)`](/documentation/Foundation/NS_EXTENSION_UNAVAILABLE)

[`#define NS_EXTENSION_UNAVAILABLE_IOS(_msg)`](/documentation/Foundation/NS_EXTENSION_UNAVAILABLE_IOS)

[`#define NS_EXTENSION_UNAVAILABLE_MAC(_msg)`](/documentation/Foundation/NS_EXTENSION_UNAVAILABLE_MAC)

[`#define NS_FALLTHROUGH`](/documentation/Foundation/NS_FALLTHROUGH)

[`#define NS_FORMAT_ARGUMENT(A)`](/documentation/Foundation/NS_FORMAT_ARGUMENT)

[`#define NS_FORMAT_FUNCTION(F, A)`](/documentation/Foundation/NS_FORMAT_FUNCTION)

[`#define NS_HEADER_AUDIT_BEGIN(...)`](/documentation/Foundation/NS_HEADER_AUDIT_BEGIN)

[`#define NS_HEADER_AUDIT_END(...)`](/documentation/Foundation/NS_HEADER_AUDIT_END)

[`#define NS_INLINE`](/documentation/Foundation/NS_INLINE)

[`#define NS_NO_TAIL_CALL`](/documentation/Foundation/NS_NO_TAIL_CALL)

[`#define NS_NOESCAPE`](/documentation/Foundation/NS_NOESCAPE)

[`#define NS_NONATOMIC_IOSONLY`](/documentation/Foundation/NS_NONATOMIC_IOSONLY)

[`#define NS_NONATOMIC_IPHONEONLY`](/documentation/Foundation/NS_NONATOMIC_IPHONEONLY)

[`#define NS_OPTIONS(_type, _name)`](/documentation/Foundation/NS_OPTIONS)

[`#define NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION`](/documentation/Foundation/NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION)

[`#define NS_REFINED_FOR_SWIFT`](/documentation/Foundation/NS_REFINED_FOR_SWIFT)

[`#define NS_REFINED_FOR_SWIFT_ASYNC(COMPLETION_BLOCK_INDEX)`](/documentation/Foundation/NS_REFINED_FOR_SWIFT_ASYNC)

[`#define NS_RELEASES_ARGUMENT`](/documentation/Foundation/NS_RELEASES_ARGUMENT)

[`#define NS_REPLACES_RECEIVER`](/documentation/Foundation/NS_REPLACES_RECEIVER)

[`#define NS_REQUIRES_NIL_TERMINATION`](/documentation/Foundation/NS_REQUIRES_NIL_TERMINATION)

[`#define NS_REQUIRES_PROPERTY_DEFINITIONS`](/documentation/Foundation/NS_REQUIRES_PROPERTY_DEFINITIONS)

[`#define NS_REQUIRES_SUPER`](/documentation/Foundation/NS_REQUIRES_SUPER)

[`#define NS_RETURNS_INNER_POINTER`](/documentation/Foundation/NS_RETURNS_INNER_POINTER)

[`#define NS_RETURNS_NOT_RETAINED`](/documentation/Foundation/NS_RETURNS_NOT_RETAINED)

[`#define NS_RETURNS_RETAINED`](/documentation/Foundation/NS_RETURNS_RETAINED)

[`#define NS_ROOT_CLASS`](/documentation/Foundation/NS_ROOT_CLASS)

[`#define NS_STRING_ENUM`](/documentation/Foundation/NS_STRING_ENUM)

[`#define NS_SWIFT_ASYNC(COMPLETION_BLOCK_INDEX)`](/documentation/Foundation/NS_SWIFT_ASYNC)

[`#define NS_SWIFT_ASYNC_NAME(NAME)`](/documentation/Foundation/NS_SWIFT_ASYNC_NAME)

[`#define NS_SWIFT_ASYNC_NOTHROW`](/documentation/Foundation/NS_SWIFT_ASYNC_NOTHROW)

[`#define NS_SWIFT_ASYNC_THROWS_ON_FALSE(FALSE_PARAMETER_INDEX)`](/documentation/Foundation/NS_SWIFT_ASYNC_THROWS_ON_FALSE)

[`#define NS_SWIFT_ASYNC_THROWS_ON_TRUE(TRUE_PARAMETER_INDEX)`](/documentation/Foundation/NS_SWIFT_ASYNC_THROWS_ON_TRUE)

[`#define NS_SWIFT_BRIDGED_TYPEDEF`](/documentation/Foundation/NS_SWIFT_BRIDGED_TYPEDEF)

[`#define NS_SWIFT_DISABLE_ASYNC`](/documentation/Foundation/NS_SWIFT_DISABLE_ASYNC)

[`#define NS_SWIFT_NAME(_name)`](/documentation/Foundation/NS_SWIFT_NAME)

[`#define NS_SWIFT_NONISOLATED`](/documentation/Foundation/NS_SWIFT_NONISOLATED)

[`#define NS_SWIFT_NONSENDABLE`](/documentation/Foundation/NS_SWIFT_NONSENDABLE)

[`#define NS_SWIFT_NOTHROW`](/documentation/Foundation/NS_SWIFT_NOTHROW)

[`#define NS_SWIFT_SENDABLE`](/documentation/Foundation/NS_SWIFT_SENDABLE)

[`#define NS_SWIFT_SENDING`](/documentation/Foundation/NS_SWIFT_SENDING)

[`#define NS_SWIFT_UI_ACTOR`](/documentation/Foundation/NS_SWIFT_UI_ACTOR)

[`#define NS_SWIFT_UNAVAILABLE(_msg)`](/documentation/Foundation/NS_SWIFT_UNAVAILABLE)

[`#define NS_SWIFT_UNAVAILABLE_FROM_ASYNC(msg)`](/documentation/Foundation/NS_SWIFT_UNAVAILABLE_FROM_ASYNC)

[`#define NS_TYPED_ENUM`](/documentation/Foundation/NS_TYPED_ENUM)

[`#define NS_TYPED_EXTENSIBLE_ENUM`](/documentation/Foundation/NS_TYPED_EXTENSIBLE_ENUM)

[`#define NS_UNAVAILABLE`](/documentation/Foundation/NS_UNAVAILABLE)

[`#define NS_UNICHAR_IS_EIGHT_BIT`](/documentation/Foundation/NS_UNICHAR_IS_EIGHT_BIT)

[`#define NS_VALID_UNTIL_END_OF_SCOPE`](/documentation/Foundation/NS_VALID_UNTIL_END_OF_SCOPE)

Marks local variables of type `id` or pointer-to-ObjC-object-type so that values stored into those local variable are not aggressively released by the compiler during optimization. Instead, the values are held until either the variable is assigned to again, or the end of the scope of the local variable (such as in a compound statement or a method definition).

[`#define NS_WARN_UNUSED_RESULT`](/documentation/Foundation/NS_WARN_UNUSED_RESULT)

[`#define NSEDGEINSETS_DEFINED`](/documentation/Foundation/NSEDGEINSETS_DEFINED)

[`#define NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES`](/documentation/Foundation/NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)

[`#define NSLocalizedAttributedString(key, comment)`](/documentation/Foundation/NSLocalizedAttributedString)

[`#define NSLocalizedAttributedStringFromTable(key, tbl, comment)`](/documentation/Foundation/NSLocalizedAttributedStringFromTable)

[`#define NSLocalizedAttributedStringFromTableInBundle(key, tbl, bundle, comment)`](/documentation/Foundation/NSLocalizedAttributedStringFromTableInBundle)

[`#define NSLocalizedAttributedStringWithDefaultValue(key, tbl, bundle, val, comment)`](/documentation/Foundation/NSLocalizedAttributedStringWithDefaultValue)

[`#define NSObjectAutoreleasedEvent`](/documentation/Foundation/NSObjectAutoreleasedEvent)

[`#define NSObjectExtraRefDecrementedEvent`](/documentation/Foundation/NSObjectExtraRefDecrementedEvent)

[`#define NSObjectExtraRefIncrementedEvent`](/documentation/Foundation/NSObjectExtraRefIncrementedEvent)

[`#define NSObjectInternalRefDecrementedEvent`](/documentation/Foundation/NSObjectInternalRefDecrementedEvent)

[`#define NSObjectInternalRefIncrementedEvent`](/documentation/Foundation/NSObjectInternalRefIncrementedEvent)

[`#define NSOperationQualityOfService`](/documentation/Foundation/NSOperationQualityOfService)

[`#define NSOperationQualityOfServiceBackground`](/documentation/Foundation/NSOperationQualityOfServiceBackground)

[`#define NSOperationQualityOfServiceUserInitiated`](/documentation/Foundation/NSOperationQualityOfServiceUserInitiated)

[`#define NSOperationQualityOfServiceUserInteractive`](/documentation/Foundation/NSOperationQualityOfServiceUserInteractive)

[`#define NSOperationQualityOfServiceUtility`](/documentation/Foundation/NSOperationQualityOfServiceUtility)

[`#define NSURLSESSION_AVAILABLE`](/documentation/Foundation/NSURLSESSION_AVAILABLE)

[`#define NS_SWIFT_NONISOLATED_UNSAFE`](/documentation/Foundation/NS_SWIFT_NONISOLATED_UNSAFE)

### Type Aliases

[`typealias uuid_string_t`](/documentation/Foundation/uuid_string_t)

[`typealias uuid_t`](/documentation/Foundation/uuid_t)

### Type Aliases

[`struct NSAttributedStringFormattingContextKey`](/documentation/Foundation/NSAttributedStringFormattingContextKey)

A type that represents a key in the formatting context dictionary.

[`struct NSKeyValueChangeKey`](/documentation/Foundation/NSKeyValueChangeKey)

The keys that can appear in the change dictionary.

[`struct NSKeyValueOperator`](/documentation/Foundation/NSKeyValueOperator)

These constants define the available array operators. See [Using Collection Operators](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueCoding/CollectionOperators.html) for more information.

### Unions



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)