Skip to content

Commit f74d3ba

Browse files
committed
Make DocumentationBundle.Info initializer public
1 parent 7446d1d commit f74d3ba

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

Sources/SwiftDocC/Infrastructure/Workspace/DefaultAvailability.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public struct DefaultAvailability: Codable, Equatable {
4444
/// A string representation of the version for this platform.
4545
public var platformVersion: String
4646

47-
/// Create a new module availability with a given platform name and platform version.
47+
/// Creates a new module availability with a given platform name and platform version.
4848
///
4949
/// - Parameters:
5050
/// - platformName: A platform name, such as "iOS" or "macOS"; see ``PlatformName``.
5151
/// - platformVersion: A 2- or 3-component version string, such as `"13.0"` or `"13.1.2"`
52-
init(platformName: PlatformName, platformVersion: String) {
52+
public init(platformName: PlatformName, platformVersion: String) {
5353
self.platformName = platformName
5454
self.platformVersion = platformVersion
5555
}
@@ -70,7 +70,9 @@ public struct DefaultAvailability: Codable, Equatable {
7070
/// For example: "ModuleName" -> ["macOS 10.15", "iOS 13.0"]
7171
var modules: [String: [ModuleAvailability]]
7272

73-
init(with modules: [String: [ModuleAvailability]]) {
73+
/// Creates a default availability module.
74+
/// - Parameter modules: A map of modules and the default platform availability for symbols in that module.
75+
public init(with modules: [String: [ModuleAvailability]]) {
7476
self.modules = modules.mapValues { platformAvailabilities -> [DefaultAvailability.ModuleAvailability] in
7577
// If a module doesn't contain default introduced availability for macCatalyst,
7678
// infer it from iOS. Their platform versions are always the same.

Sources/SwiftDocC/Infrastructure/Workspace/DocumentationBundle+Info.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,31 @@ extension DocumentationBundle {
7878
}
7979
}
8080

81+
82+
/// Creates a new documentation bundle information value.
83+
/// - Parameters:
84+
/// - displayName: The display name of the bundle.
85+
/// - identifier: The unique identifier of the bundle.
86+
/// - version: The version of the bundle.
87+
/// - defaultCodeListingLanguage: The default language identifier for code listings in the bundle.
88+
/// - defaultAvailability: The default availability for the various modules in the bundle.
89+
/// - defaultModuleKind: The default kind for the various modules in the bundle.
90+
public init(
91+
displayName: String,
92+
identifier: String,
93+
version: String?,
94+
defaultCodeListingLanguage: String?,
95+
defaultAvailability: DefaultAvailability?,
96+
defaultModuleKind: String?
97+
) {
98+
self.displayName = displayName
99+
self.identifier = identifier
100+
self.version = version
101+
self.defaultCodeListingLanguage = defaultCodeListingLanguage
102+
self.defaultAvailability = defaultAvailability
103+
self.defaultModuleKind = defaultModuleKind
104+
}
105+
81106
/// Creates documentation bundle information from the given Info.plist data, falling back to the values
82107
/// in the given bundle discovery options if necessary.
83108
init(

0 commit comments

Comments
 (0)