Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for including Swift packages in the template specification.
- Loading branch information
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Copyright © 2023 Apparata AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct BootstrappPackage: Identifiable { | ||
public var id: String { name } | ||
public let name: String | ||
public let url: String | ||
public let version: String | ||
|
||
public init(name: String, url: String, version: String) { | ||
self.name = name | ||
self.url = url | ||
self.version = version | ||
} | ||
} | ||
|
||
extension BootstrappPackage: Codable { | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case id | ||
case name | ||
case url | ||
case version | ||
} | ||
|
||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
name = try container.decode(String.self, forKey: .name) | ||
url = try container.decode(String.self, forKey: .url) | ||
version = try container.decode(String.self, forKey: .version) | ||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encode(name, forKey: .name) | ||
try container.encode(url, forKey: .url) | ||
try container.encode(version, forKey: .version) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters