Skip to content

Commit acc15c9

Browse files
committed
Make a number of RenderNode constants vars
This updates some of the properties in the RenderNode tree to be mutable. A number of the top-level properties in RenderNode are already mutable, and making these additional properties mutable as well allows callers to modify these values. rdar://164748009
1 parent 5370377 commit acc15c9

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ public enum RenderBlockContent: Equatable {
630630
/// A list of rendering block elements.
631631
public typealias Cell = [RenderBlockContent]
632632
/// The list of row cells.
633-
public let cells: [Cell]
633+
public var cells: [Cell]
634634

635635
/// Creates a new table row.
636636
/// - Parameter cells: The list of row cells to use.
@@ -692,18 +692,18 @@ public enum RenderBlockContent: Equatable {
692692
/// A term rendered as content.
693693
public struct Term: Codable, Equatable {
694694
/// The term content.
695-
public let inlineContent: [RenderInlineContent]
695+
public var inlineContent: [RenderInlineContent]
696696
}
697697
/// A definition rendered as a list of block-content elements.
698698
public struct Definition: Codable, Equatable {
699699
/// The definition content.
700-
public let content: [RenderBlockContent]
700+
public var content: [RenderBlockContent]
701701
}
702702

703703
/// The term in the term-list item.
704-
public let term: Term
704+
public var term: Term
705705
/// The definition in the term-list item.
706-
public let definition: Definition
706+
public var definition: Definition
707707
}
708708

709709
/// A row in a grid-based layout system that describes a collection of columns.
@@ -713,18 +713,18 @@ public enum RenderBlockContent: Equatable {
713713
/// This may be different then the count of ``columns`` array. For example, there may be
714714
/// individual columns that span multiple columns (specified with the column's
715715
/// ``Column/size`` property) or the row could be not fully filled with columns.
716-
public let numberOfColumns: Int
716+
public var numberOfColumns: Int
717717

718718
/// The columns that should be rendered in this row.
719-
public let columns: [Column]
719+
public var columns: [Column]
720720

721721
/// A column with a row in a grid-based layout system.
722722
public struct Column: Codable, Equatable {
723723
/// The number of columns in the parent row this column should span.
724-
public let size: Int
724+
public var size: Int
725725

726726
/// The content that should be rendered in this column.
727-
public let content: [RenderBlockContent]
727+
public var content: [RenderBlockContent]
728728
}
729729
}
730730

@@ -734,21 +734,21 @@ public enum RenderBlockContent: Equatable {
734734
/// license, or copyright text.
735735
public struct Small: Codable, Equatable {
736736
/// The inline content that should be rendered.
737-
public let inlineContent: [RenderInlineContent]
737+
public var inlineContent: [RenderInlineContent]
738738
}
739739

740740
/// A collection of content that should be rendered in a tab-based layout.
741741
public struct TabNavigator: Codable, Equatable {
742742
/// The tabs that make up this tab navigator.
743-
public let tabs: [Tab]
743+
public var tabs: [Tab]
744744

745745
/// A titled tab inside a tab-based layout container.
746746
public struct Tab: Codable, Equatable {
747747
/// The title that should be used to identify this tab.
748-
public let title: String
748+
public var title: String
749749

750750
/// The content that should be rendered in this tab.
751-
public let content: [RenderBlockContent]
751+
public var content: [RenderBlockContent]
752752
}
753753
}
754754

@@ -770,10 +770,10 @@ public enum RenderBlockContent: Equatable {
770770
}
771771

772772
/// The style that should be used when rendering the link items.
773-
public let style: Style
773+
public var style: Style
774774

775775
/// The topic render references for the pages that should be rendered in this links block.
776-
public let items: [String]
776+
public var items: [String]
777777

778778
/// Create a new links block with the given style and topic render references.
779779
public init(style: RenderBlockContent.Links.Style, items: [String]) {
@@ -785,10 +785,10 @@ public enum RenderBlockContent: Equatable {
785785
/// A video with an optional caption.
786786
public struct Video: Codable, Equatable {
787787
/// A reference to the video media that should be rendered in this block.
788-
public let identifier: RenderReferenceIdentifier
788+
public var identifier: RenderReferenceIdentifier
789789

790790
/// Any metadata associated with this video, like a caption.
791-
public let metadata: RenderContentMetadata?
791+
public var metadata: RenderContentMetadata?
792792

793793
/// Create a new video with the given identifier and metadata.
794794
public init(identifier: RenderReferenceIdentifier, metadata: RenderContentMetadata? = nil) {

Sources/SwiftDocC/Model/Rendering/Symbol/ParameterRenderSection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
public struct ParametersRenderSection: RenderSection, Equatable {
1313
public var kind: RenderSectionKind = .parameters
1414
/// The list of parameter sub-sections.
15-
public let parameters: [ParameterRenderSection]
15+
public var parameters: [ParameterRenderSection]
1616

1717
/// Creates a new parameters section with the given list.
1818
public init(parameters: [ParameterRenderSection]) {

Sources/SwiftDocC/Model/Rendering/Symbol/PropertiesRenderSection.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import Foundation
1616
public struct PropertiesRenderSection: RenderSection {
1717
public var kind: RenderSectionKind = .properties
1818
/// The title for this section.
19-
public let title: String
19+
public var title: String
2020
/// The list of properties.
21-
public let items: [RenderProperty]
21+
public var items: [RenderProperty]
2222

2323
/// Creates a new property-list section.
2424
/// - Parameters:
@@ -60,9 +60,9 @@ public struct RenderProperty: Codable, TextIndexing, Equatable {
6060
/// The list of possible type declarations for the property's value including additional details, if available.
6161
public let typeDetails: [TypeDetails]?
6262
/// Additional details about the property, if available.
63-
public let content: [RenderBlockContent]?
63+
public var content: [RenderBlockContent]?
6464
/// Additional list of attributes, if any.
65-
public let attributes: [RenderAttribute]?
65+
public var attributes: [RenderAttribute]?
6666
/// A mime-type associated with the property, if applicable.
6767
public let mimeType: String?
6868
/// If true, the property is required in its containing context.

Sources/SwiftDocC/Model/Rendering/Symbol/RESTBodyRenderSection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Foundation
1414
public struct RESTBodyRenderSection: RenderSection, Equatable {
1515
public var kind: RenderSectionKind = .restBody
1616
/// A title for the section.
17-
public let title: String
17+
public var title: String
1818

1919
/// Content encoding MIME type for the request body.
2020
public let mimeType: String
@@ -23,14 +23,14 @@ public struct RESTBodyRenderSection: RenderSection, Equatable {
2323
public let bodyContentType: [DeclarationRenderSection.Token]
2424

2525
/// Details about the request body, if available.
26-
public let content: [RenderBlockContent]?
26+
public var content: [RenderBlockContent]?
2727

2828
/// A list of request parameters, if applicable.
2929
///
3030
/// If the body content is `multipart/form-data` encoded, it contains a list
3131
/// of parameters. Each of these parameters is a ``RESTParameter``
3232
/// and it has its own value-content encoding, name, type, and description.
33-
public let parameters: [RenderProperty]?
33+
public var parameters: [RenderProperty]?
3434

3535
/// Creates a new REST body section.
3636
/// - Parameters:

Sources/SwiftDocC/Model/Rendering/Symbol/RESTEndpointRenderSection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public struct RESTEndpointRenderSection: RenderSection, Equatable {
5050
}
5151

5252
/// The title for the section.
53-
public let title: String
53+
public var title: String
5454

5555
/// The list of tokens.
5656
public let tokens: [Token]

Sources/SwiftDocC/Model/Rendering/Symbol/RESTParametersRenderSection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public enum RESTParameterSource: String, Codable {
2929
public struct RESTParametersRenderSection: RenderSection, Equatable {
3030
public var kind: RenderSectionKind = .restParameters
3131
/// The title for the section.
32-
public let title: String
32+
public var title: String
3333
/// The list of REST parameters.
34-
public let parameters: [RenderProperty]
34+
public var parameters: [RenderProperty]
3535
/// The kind of listed parameters.
3636
public let source: RESTParameterSource
3737

Sources/SwiftDocC/Model/Rendering/Symbol/RESTResponseRenderSection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import Foundation
1414
public struct RESTResponseRenderSection: RenderSection, Equatable {
1515
public var kind: RenderSectionKind = .restResponses
1616
/// The title for the section.
17-
public let title: String
17+
public var title: String
1818
/// The list of possible REST responses.
19-
public let responses: [RESTResponse]
19+
public var responses: [RESTResponse]
2020

2121
enum CodingKeys: String, CodingKey {
2222
case kind
@@ -70,7 +70,7 @@ public struct RESTResponse: Codable, TextIndexing, Equatable {
7070
/// A type declaration of the response's content.
7171
public let type: [DeclarationRenderSection.Token]
7272
/// Response details, if any.
73-
public let content: [RenderBlockContent]?
73+
public var content: [RenderBlockContent]?
7474

7575
/// Creates a new REST response section.
7676
/// - Parameters:

0 commit comments

Comments
 (0)