Framework

Swift Standard Library

Solve complex problems and write high-performance, readable code.

Overview

The Swift standard library defines a base layer of functionality for writing Swift programs, including:

Topics

Values and Collections

Numbers and Basic Values

Model data with numbers, Boolean values, and other fundamental types.

Strings and Text

Work with text using Unicode-safe strings.

Collections

Store and organize data using arrays, dictionaries, sets, and other data structures.

Tools for Your Types

Basic Behaviors

Use your custom types in operations that depend on testing for equality or order and as members of sets and dictionaries.

Encoding, Decoding, and Serialization

Serialize and deserialize instances of your types with implicit or customized encoding.

Initialization with Literals

Allow values of your type to be expressed using different kinds of literals.

Programming Tasks

Input and Output

Print values to the console, read from and write to text streams, and use command line arguments.

Debugging and Reflection

Fortify your code with runtime checks, and examine your values' runtime representation.

Key-Path Expressions

Use key-path expressions to access properties dynamically.

Manual Memory Management

Allocate and manage memory manually.

Type Casting and Existential Types

Perform casts between types or represent values of any type.

C Interoperability

Use imported C types or call C variadic functions.

Operator Declarations

Work with prefix, postfix, and infix operators.

Reference

Operators

Operator declarations and their corresponding global operator functions.