下記URLから引用し、日本語訳をつけてみました。
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/
Topic
Welcome to Swift
Understand the high-level goals of the language.
言語の高レベルの目標を理解します。
Learn what functionality is available in older language modes.
古い言語モードで利用できる機能について説明します。
Explore the features and syntax of Swift.
Swift の機能と構文を調べます。
セクションリスト
Language Guide
Work with common kinds of data and write basic syntax.
一般的な種類のデータを操作し、基本的な構文を作成します。
セクションリスト
- Constants and Variables
- Declaring Constants and Variables
- Type Annotations
- Naming Constants and Variables
- Printing Constants and Variables
- Comments
- Semicolons
- Integers
- Integer Bounds
- Int
- UInt
- Floating-Point Numbers
- Type Safety and Type Inference
- Numeric Literals
- Numeric Type Conversion
- Integer Conversion
- Integer and Floating-Point Conversion
- Type Aliases
- Booleans
- Tuples
- Optionals
- nil
- Optional Binding
- Providing a Fallback Value
- Force Unwrapping
- Implicitly Unwrapped Optionals
- Error Handling
- Assertions and Preconditions
- Debugging with Assertions
- Enforcing Preconditions
Perform operations like assignment, arithmetic, and comparison.
代入、算術、比較などの演算を実行します。
セクションリスト
- Terminology
- Assignment Operator
- Arithmetic Operators
- Remainder Operator
- Unary Minus Operator
- Unary Plus Operator
- Compound Assignment Operators
- Comparison Operators
- Ternary Conditional Operator
- Nil-Coalescing Operator
- Range Operators
- Closed Range Operator
- Half-Open Range Operator
- One-Sided Ranges
- Logical Operators
- Logical NOT Operator
- Logical AND Operator
- Logical OR Operator
- Combining Logical Operators
- Explicit Parentheses
Store and manipulate text.
テキストを保存および操作します。
セクションリスト
- String Literals
- Multiline String Literals
- Special Characters in String Literals
- Extended String Delimiters
- Initializing an Empty String
- String Mutability
- Strings Are Value Types
- Working with Characters
- Concatenating Strings and Characters
- String Interpolation
- Unicode
- Unicode Scalar Values
- Extended Grapheme Clusters
- Counting Characters
- Accessing and Modifying a String
- String Indices
- Inserting and Removing
- Substrings
- Comparing Strings
- String and Character Equality
- Prefix and Suffix Equality
- Unicode Representations of Strings
- UTF-8 Representation
- UTF-16 Representation
- Unicode Scalar Representation
Organize data using arrays, sets, and dictionaries.
配列、セット、辞書を使用してデータを整理します。
セクションリスト
- Mutability of Collections
- Arrays
- Array Type Shorthand Syntax
- Creating an Empty Array
- Creating an Array with a Default Value
- Creating an Array by Adding Two Arrays Together
- Creating an Array with an Array Literal
- Accessing and Modifying an Array
- Iterating Over an Array
- Sets
- Hash Values for Set Types
- Set Type Syntax
- Creating and Initializing an Empty Set
- Creating a Set with an Array Literal
- Accessing and Modifying a Set
- Iterating Over a Set
- Performing Set Operations
- Fundamental Set Operations
- Set Membership and Equality
- Dictionaries
- Dictionary Type Shorthand Syntax
- Creating an Empty Dictionary
- Creating a Dictionary with a Dictionary Literal
- Accessing and Modifying a Dictionary
- Iterating Over a Dictionary
Structure code with branches, loops, and early exits.
分岐、ループ、早期終了を含む構造コード。
セクションリスト
- For-In Loops
- While Loops
- While
- Repeat-While
- Conditional Statements
- If
- Switch
- No Implicit Fallthrough
- Interval Matching
- Tuples
- Value Bindings
- Where
- Compound Cases
- Control Transfer Statements
- Continue
- Break
- Break in a Loop Statement
- Break in a Switch Statement
- Fallthrough
- Labeled Statements
- Early Exit
- Deferred Actions
- Checking API Availability
Define and call functions, label their arguments, and use their return values.
関数を定義して呼び出し、引数にラベルを付け、戻り値を使用します。
セクションリスト
- Defining and Calling Functions
- Function Parameters and Return Values
- Functions Without Parameters
- Functions With Multiple Parameters
- Functions Without Return Values
- Functions with Multiple Return Values
- Optional Tuple Return Types
- Functions With an Implicit Return
- Function Argument Labels and Parameter Names
- Specifying Argument Labels
- Omitting Argument Labels
- Default Parameter Values
- Variadic Parameters
- In-Out Parameters
- Function Types
- Using Function Types
- Function Types as Parameter Types
- Function Types as Return Types
- Nested Functions
Group code that executes together, without creating a named function.
名前付き関数を作成せずに、一緒に実行されるコードをグループ化します。
セクションリスト
Model custom types that define a list of possible values.
可能な値のリストを定義するカスタム 型をモデル化します。
セクションリスト
Model custom types that encapsulate data.
データをカプセル化するカスタム 型をモデル化します。
セクションリスト
Access stored and computed values that are part of an instance or type.
インスタンスまたは型の一部である保存値および計算値にアクセスします。
セクションリスト
- Stored Properties of Constant Structure Instances
- Lazy Stored Properties
- Stored Properties and Instance Variables
- Computed Properties
- Shorthand Setter Declaration
- Read-Only Computed Properties
- Property Observers
- Property Wrappers
- Setting Initial Values for Wrapped Properties
- Projecting a Value From a Property Wrapper
- Global and Local Variables
- Type Properties
- Type Property Syntax
- Querying and Setting Type Properties
Define and call functions that are part of an instance or type.
インスタンスまたは型の一部である関数を定義して呼び出します。
セクションリスト
Access the elements of a collection.
コレクションの要素にアクセスします。
Subclass to add or override functionality.
機能を追加またはオーバーライドするサブクラス。
セクションリスト
Set the initial values for a type’s stored properties and perform one-time setup.
型の保存されたプロパティの初期値を設定し、1 回限りのセットアップを実行します。
セクションリスト
- Setting Initial Values for Stored Properties
- Initializers
- Default Property Values
- Customizing Initialization
- Initialization Parameters
- Parameter Names and Argument Labels
- Initializer Parameters Without Argument Labels
- Optional Property Types
- Assigning Constant Properties During Initialization
- Default Initializers
- Memberwise Initializers for Structure Types
- Initializer Delegation for Value Types
- Class Inheritance and Initialization
- Designated Initializers and Convenience Initializers
- Syntax for Designated and Convenience Initializers
- Initializer Delegation for Class Types
- Two-Phase Initialization
- Initializer Inheritance and Overriding
- Automatic Initializer Inheritance
- Designated and Convenience Initializers in Action
- Failable Initializers
- Failable Initializers for Enumerations
- Failable Initializers for Enumerations with Raw Values
- Propagation of Initialization Failure
- Overriding a Failable Initializer
- The init! Failable Initializer
- Required Initializers
- Setting a Default Property Value with a Closure or Function
Release resources that require custom cleanup.
カスタム クリーンアップが必要なリソースを解放します。
Access members of an optional value without unwrapping.
アンラップせずにオプションの値のメンバーにアクセスします。
セクションリスト
- Optional Chaining as an Alternative to Forced Unwrapping
- Defining Model Classes for Optional Chaining
- Accessing Properties Through Optional Chaining
- Calling Methods Through Optional Chaining
- Accessing Subscripts Through Optional Chaining
- Accessing Subscripts of Optional Type
- Linking Multiple Levels of Chaining
- Chaining on Methods with Optional Return Values
Respond to and recover from errors.
エラーに応答し、エラーから回復します。
セクションリスト
Perform asynchronous operations.
非同期操作を実行します。
セクションリスト
Use macros to generate code at compile time.
マクロを使用してコンパイル時にコードを生成します。
セクションリスト
Determine a value’s runtime type and give it more specific type information.
値の実行時の型を特定し、より具体的な型情報を与えます。
セクションリスト
Define types inside the scope of another type.
別の型のスコープ内で型を定義します。
Add functionality to an existing type.
既存の型に機能を追加します。
セクションリスト
Define requirements that conforming types must implement.
適合する型が実装する必要がある要件を定義します。
セクションリスト
- Protocol Syntax
- Property Requirements
- Method Requirements
- Mutating Method Requirements
- Initializer Requirements
- Class Implementations of Protocol Initializer Requirements
- Failable Initializer Requirements
- Protocols as Types
- Delegation
- Adding Protocol Conformance with an Extension
- Conditionally Conforming to a Protocol
- Declaring Protocol Adoption with an Extension
- Adopting a Protocol Using a Synthesized Implementation
- Collections of Protocol Types
- Protocol Inheritance
- Class-Only Protocols
- Protocol Composition
- Checking for Protocol Conformance
- Optional Protocol Requirements
- Protocol Extensions
- Providing Default Implementations
- Adding Constraints to Protocol Extensions
Write code that works for multiple types and specify requirements for those types.
複数の型で機能するコードを作成し、それらの型の要件を指定します。
セクションリスト
- The Problem That Generics Solve
- Generic Functions
- Type Parameters
- Naming Type Parameters
- Generic Types
- Extending a Generic Type
- Type Constraints
- Type Constraint Syntax
- Type Constraints in Action
- Associated Types
- Associated Types in Action
- Extending an Existing Type to Specify an Associated Type
- Adding Constraints to an Associated Type
- Using a Protocol in Its Associated Type’s Constraints
- Generic Where Clauses
- Extensions with a Generic Where Clause
- Contextual Where Clauses
- Associated Types with a Generic Where Clause
- Generic Subscripts
Hide implementation details about a value’s type.
値の型に関する実装の詳細を非表示にします。
セクションリスト
Model the lifetime of objects and their relationships.
オブジェクトの存続期間とその関係をモデル化します。
セクションリスト
- How ARC Works
- ARC in Action
- Strong Reference Cycles Between Class Instances
- Resolving Strong Reference Cycles Between Class Instances
- Weak References
- Unowned References
- Unowned Optional References
- Unowned References and Implicitly Unwrapped Optional Properties
- Strong Reference Cycles for Closures
- Resolving Strong Reference Cycles for Closures
- Defining a Capture List
- Weak and Unowned References
Structure your code to avoid conflicts when accessing memory.
メモリにアクセスする際の競合を回避するようにコードを構造化します。
セクションリスト
Manage the visibility of code by declaration, file, and module.
コードの可視性を宣言、ファイル、モジュールごとに管理します。
セクションリスト
- Modules and Source Files
- Access Levels
- Guiding Principle of Access Levels
- Default Access Levels
- Access Levels for Single-Target Apps
- Access Levels for Frameworks
- Access Levels for Unit Test Targets
- Access Control Syntax
- Custom Types
- Tuple Types
- Function Types
- Enumeration Types
- Raw Values and Associated Values
- Nested Types
- Subclassing
- Constants, Variables, Properties, and Subscripts
- Getters and Setters
- Initializers
- Default Initializers
- Default Memberwise Initializers for Structure Types
- Protocols
- Protocol Inheritance
- Protocol Conformance
- Extensions
- Private Members in Extensions
- Generics
- Type Aliases
Define custom operators, perform bitwise operations, and use builder syntax.
カスタム演算子を定義し、ビットごとの演算を実行し、ビルダー構文を使用します。
セクションリスト
- Bitwise Operators
- Bitwise NOT Operator
- Bitwise AND Operator
- Bitwise OR Operator
- Bitwise XOR Operator
- Bitwise Left and Right Shift Operators
- Shifting Behavior for Unsigned Integers
- Shifting Behavior for Signed Integers
- Overflow Operators
- Value Overflow
- Precedence and Associativity
- Operator Methods
- Prefix and Postfix Operators
- Compound Assignment Operators
- Equivalence Operators
- Custom Operators
- Precedence for Custom Infix Operators
- Result Builders
Language Reference
Read the notation that the formal grammar uses.
正式な文法で使用されている表記法を読む。
セクションリスト
Use the lowest-level components of the syntax.
構文の最下位レベルのコンポーネントを使用します。
セクションリスト
Use built-in named and compound types.
組み込みの名前付き型と複合型を使用します。
セクションリスト
- Type Annotation
- Type Identifier
- Tuple Type
- Function Type
- Restrictions for Nonescaping Closures
- Array Type
- Dictionary Type
- Optional Type
- Implicitly Unwrapped Optional Type
- Protocol Composition Type
- Opaque Type
- Boxed Protocol Type
- Metatype Type
- Any Type
- Self Type
- Type Inheritance Clause
- Type Inference
Access, modify, and assign values.
値にアクセス、変更、割り当てます。
セクションリスト
- Prefix Expressions
- In-Out Expression
- Try Operator
- Await Operator
- Infix Expressions
- Assignment Operator
- Ternary Conditional Operator
- Type-Casting Operators
- Primary Expressions
- Literal Expression
- Self Expression
- Superclass Expression
- Conditional Expression
- Closure Expression
- Capture Lists
- Implicit Member Expression
- Parenthesized Expression
- Tuple Expression
- Wildcard Expression
- Macro-Expansion Expression
- Key-Path Expression
- Selector Expression
- Key-Path String Expression
- Postfix Expressions
- Function Call Expression
- Implicit Conversion to a Pointer Type
- Initializer Expression
- Explicit Member Expression
- Postfix Self Expression
- Subscript Expression
- Forced-Value Expression
- Optional-Chaining Expression
Group expressions and control the flow of execution.
式をグループ化し、実行フローを制御します。
セクションリスト
- Loop Statements
- For-In Statement
- While Statement
- Repeat-While Statement
- Branch Statements
- If Statement
- Guard Statement
- Switch Statement
- Switch Statements Must Be Exhaustive
- Switching Over Future Enumeration Cases
- Execution Does Not Fall Through Cases Implicitly
- Labeled Statement
- Control Transfer Statements
- Break Statement
- Continue Statement
- Fallthrough Statement
- Return Statement
- Throw Statement
- Defer Statement
- Do Statement
- Compiler Control Statements
- Conditional Compilation Block
- Line Control Statement
- Compile-Time Diagnostic Statement
- Availability Condition
Introduce types, operators, variables, and other names and constructs.
型、演算子、変数、その他の名前と構成要素を紹介します。
セクションリスト
- Top-Level Code
- Code Blocks
- Import Declaration
- Constant Declaration
- Variable Declaration
- Stored Variables and Stored Variable Properties
- Stored Variable Observers and Property Observers
- Type Alias Declaration
- Function Declaration
- Parameter Names
- Parameter Modifiers
- In-Out Parameters
- Borrowing and Consuming Parameters
- Special Kinds of Parameters
- Special Kinds of Methods
- Methods with Special Names
- Throwing Functions and Methods
- Rethrowing Functions and Methods
- Asynchronous Functions and Methods
- Functions that Never Return
- Enumeration Declaration
- Enumerations with Cases of Any Type
- Enumerations with Indirection
- Enumerations with Cases of a Raw-Value Type
- Accessing Enumeration Cases
- Structure Declaration
- Class Declaration
- Actor Declaration
- Protocol Declaration
- Protocol Property Declaration
- Protocol Method Declaration
- Protocol Initializer Declaration
- Protocol Subscript Declaration
- Protocol Associated Type Declaration
- Initializer Declaration
- Failable Initializers
- Deinitializer Declaration
- Extension Declaration
- Conditional Conformance
- Overridden Requirements Aren’t Used in Some Generic Contexts
- Protocol Conformance Must Not Be Redundant
- Resolving Explicit Redundancy
- Resolving Implicit Redundancy
- Subscript Declaration
- Type Subscript Declarations
- Macro Declaration
- Operator Declaration
- Precedence Group Declaration
- Declaration Modifiers
- Access Control Levels
Add information to declarations and types.
宣言と型に情報を追加します。
セクションリスト
- Declaration Attributes
- attached
- available
- backDeployed
- discardableResult
- dynamicCallable
- dynamicMemberLookup
- freestanding
- frozen
- GKInspectable
- inlinable
- main
- nonobjc
- NSApplicationMain
- NSCopying
- NSManaged
- objc
- objcMembers
- preconcurrency (6.0beta)
- propertyWrapper
- resultBuilder
- Result-Building Methods
- Result Transformations
- Custom Result-Builder Attributes
- requires_stored_property_inits
- testable
- UIApplicationMain
- unchecked
- usableFromInline
- warn_unqualified_access
- Declaration Attributes Used by Interface Builder
- Type Attributes
- autoclosure
- convention
- escaping
- Sendable
- Switch Case Attributes
- unknown
Match and destructure values.
値を照合して構造化します。
セクションリスト
Generic Parameters and Arguments
Generalize declarations to abstract away concrete types.
宣言を一般化して具体的な型を抽象化します。
Read the whole formal grammar.
正式な文法をすべて読んでください。