|
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
|
|
10 | 10 |
|
11 | 11 | import Foundation
|
12 | 12 |
|
13 |
| -/// A title style for a property list key or an entitlement key. |
| 13 | +/// A style for how to render links to a property list key or an entitlement key. |
| 14 | +public enum PropertyListTitleStyle: String, Codable, Equatable { |
| 15 | + /// Render links to the property list key using the raw key, for example "com.apple.enableDataAccess". |
| 16 | + /// |
| 17 | + /// ## See Also |
| 18 | + /// - ``TopicRenderReference/PropertyListKeyNames/rawKey`` |
| 19 | + case useRawKey = "symbol" |
| 20 | + /// Render links to the property list key using the display name, for example "Enables Data Access". |
| 21 | + /// |
| 22 | + /// ## See Also |
| 23 | + /// - ``TopicRenderReference/PropertyListKeyNames/displayName`` |
| 24 | + case useDisplayName = "title" |
| 25 | +} |
| 26 | + |
| 27 | +@available(*, deprecated, renamed: "PropertyListTitleStyle", message: "Use 'PropertyListTitleStyle' instead. This deprecated API will be removed after 6.1 is released") |
14 | 28 | public enum TitleStyle: String, Codable, Equatable {
|
15 |
| - // Render links to the symbol using the "raw" name, for example, "com.apple.enableDataAccess". |
| 29 | + @available(*, deprecated, renamed: "PropertyListTitleStyle.useRawKey", message: "Use 'PropertyListTitleStyle.useRawKey' instead. This deprecated API will be removed after 6.1 is released") |
16 | 30 | case symbol
|
17 |
| - // Render links to the symbol using a special "IDE title" name, for example, "Enables Data Access". |
| 31 | + @available(*, deprecated, renamed: "PropertyListTitleStyle.useDisplayName", message: "Use 'PropertyListTitleStyle.useDisplayName' instead. This deprecated API will be removed after 6.1 is released") |
18 | 32 | case title
|
19 | 33 | }
|
20 | 34 |
|
21 | 35 | /// A section that contains details about a property list key.
|
22 | 36 | struct PlistDetailsRenderSection: RenderSection, Equatable {
|
23 |
| - public var kind: RenderSectionKind = .plistDetails |
| 37 | + var kind: RenderSectionKind = .plistDetails |
24 | 38 | /// A title for the section.
|
25 |
| - public var title = "Details" |
| 39 | + var title = "Details" |
26 | 40 |
|
27 | 41 | /// Details for a property list key.
|
28 | 42 | struct Details: Codable, Equatable {
|
29 | 43 | /// The name of the key.
|
30 |
| - let name: String |
| 44 | + let rawKey: String |
31 | 45 | /// A list of types acceptable for this key's value.
|
32 | 46 | let value: [TypeDetails]
|
33 | 47 | /// A list of platforms to which this key applies.
|
34 | 48 | let platforms: [String]
|
35 | 49 | /// An optional, human-friendly name of the key.
|
36 |
| - let ideTitle: String? |
| 50 | + let displayName: String? |
37 | 51 | /// A title rendering style.
|
38 |
| - let titleStyle: TitleStyle |
| 52 | + let titleStyle: PropertyListTitleStyle |
| 53 | + |
| 54 | + enum CodingKeys: String, CodingKey { |
| 55 | + case rawKey = "name" |
| 56 | + case value |
| 57 | + case platforms |
| 58 | + case displayName = "ideTitle" |
| 59 | + case titleStyle |
| 60 | + } |
39 | 61 | }
|
40 | 62 |
|
41 | 63 | /// The details of the property key.
|
42 |
| - public let details: Details |
43 |
| - |
44 |
| - // MARK: - Codable |
45 |
| - |
46 |
| - /// The list of keys you use to encode or decode this details section. |
47 |
| - public enum CodingKeys: String, CodingKey { |
48 |
| - case kind, title, details |
49 |
| - } |
50 |
| - |
51 |
| - public init(from decoder: Decoder) throws { |
52 |
| - let container = try decoder.container(keyedBy: CodingKeys.self) |
53 |
| - details = try container.decode(Details.self, forKey: .details) |
54 |
| - } |
55 |
| - |
56 |
| - public func encode(to encoder: Encoder) throws { |
57 |
| - var container = encoder.container(keyedBy: CodingKeys.self) |
58 |
| - try container.encode(kind, forKey: .kind) |
59 |
| - try container.encode(title, forKey: .title) |
60 |
| - try container.encode(details, forKey: .details) |
61 |
| - } |
| 64 | + let details: Details |
62 | 65 | }
|
63 | 66 |
|
64 | 67 | // Diffable conformance
|
|
0 commit comments