You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/SwiftDocC/Semantics/Metadata/Availability.swift
+27-39
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
-
Copyright (c) 2022-2023 Apple Inc. and the Swift project authors
4
+
Copyright (c) 2022-2024 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See https://swift.org/LICENSE.txt for license information
@@ -12,50 +12,38 @@ import Foundation
12
12
import Markdown
13
13
14
14
extensionMetadata{
15
-
/// A directive that sets the platform availability information for a documentation page.
15
+
/// A directive that specifies when a documentation page is available for a given platform.
16
16
///
17
-
/// `@Available` is analogous to the `@available` attribute in Swift: It allows you to specify a
18
-
/// platform version that the page relates to. To specify a platform and version, list the platform
19
-
/// name and use the `introduced` argument. In addition, you can also specify a deprecated
20
-
/// version, using the `deprecated` argument:
17
+
/// Whenever possible, prefer to specify availability information using in-source annotations such as the `@available` attribute in Swift or the `API_AVAILABLE` macro in Objective-C.
18
+
/// Using in-source annotations ensures that your documentation matches the availability of your API.
19
+
/// If you duplicate availability information in the documentation markup, the information from the `@Available` directive overrides the information for the in-source annotations from that platform and risks being inaccurate.
/// Any text can be given to the first argument, and will be displayed in the page's
28
-
/// availability data. The platforms `iOS`, `macOS`, `watchOS`, and `tvOS` will be matched
29
-
/// case-insensitively, but anything else will be printed verbatim.
30
-
///
31
-
/// To provide a platform name with spaces in it, provide it as a quoted string:
32
-
///
33
-
/// ```markdown
34
-
/// @Available("My Package", introduced: "1.0")
35
-
/// ```
36
-
///
37
-
/// Only strings which are valid semantic version numbers may be passed to the `introduced` and `deprecated` arguments. Specifying an incomplete version number is allowed, as long as all components of the version are valid numbers:
21
+
/// If your source language doesn't have a mechanism for specifying API availability or if you're writing articles about a newly introduced or deprecated API,
22
+
/// you can use the `@Available` directive to specify when you introduced, and optionally deprecated, an API or documentation page for a given platform.
/// Both the "introduced" and "deprecated" parameters take string representations of semantic version numbers (major`.`minor`.`patch).
38
+
/// If you omit the "patch" or "minor" components, they are assumed to be `0`.
39
+
/// This means that `"1.0.0"`, `"1.0"`, and `"1"` all specify the same semantic version.
40
+
///
41
+
/// > Earlier Versions:
42
+
/// > Before Swift-DocC 6.0, the `@Available` directive didn't support the "deprecated" parameter.
43
+
///
44
+
/// > Tip:
45
+
/// > In addition to specifying the version when you deprecated an API or documentation page,
46
+
/// > you can use the ``DeprecationSummary`` directive to provide the reader with additional information about the deprecation or refer them to a replacement API.
Copy file name to clipboardExpand all lines: Sources/SwiftDocC/Semantics/Symbol/DeprecationSummary.swift
+19-4
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4
+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See https://swift.org/LICENSE.txt for license information
@@ -11,7 +11,24 @@
11
11
import Foundation
12
12
import Markdown
13
13
14
-
/// A directive to add custom deprecation summary to an already deprecated symbol.
14
+
/// A directive that specifies a custom deprecation summary message to an already deprecated symbol.
15
+
///
16
+
/// Many in-source deprecation annotations—such as the `@available` attribute in Swift—allow you to specify a plain text deprecation message.
17
+
/// You can use the `@DeprecationSummary` directive to override that deprecation message with one or more paragraphs of formatted documentation markup.
18
+
/// For example,
19
+
///
20
+
/// ```md
21
+
/// @DeprecationSummary {
22
+
/// This method is unsafe because it could potentially cause buffer overruns.
23
+
/// Use ``getBytes(_:length:)`` or ``getBytes(_:range:)`` instead.
24
+
/// }
25
+
/// ```
26
+
///
27
+
/// You can use the `@DeprecationSummary` directive top-level in both articles and documentation extension files.
28
+
///
29
+
/// > Tip:
30
+
/// > If you are writing a custom deprecation summary message for an API or documentation page that isn't already deprecated,
31
+
/// > you should also deprecate it—using in-source annotations when possible or ``Available`` directives when in-source annotations aren't available—so that the reader knows the version when you deprecated that API or documentation page.
0 commit comments