Skip to content

nicorichard/SwiftPackageDescriptionDecodable

Repository files navigation

SwiftPackageDescriptionDecodable

Provides a decodable representation for the DescribedPackage encoded json representation.

🚨 The package description returned by Swift Package Manager makes no claims about stability. Future Swift updates will undoubtedly require updates to this package as well.

Usage

This decodable can be used to parse the output of the command

swift package describe --type json

by instantiating a JSONDecoder using the .convertFromSnakeCase key decoding strategy.

import Foundation
import SwiftPackageDescriptionDecodable

func decode(json: Data) -> DescribedPackage {
    let decoder = JSONDecoder()
    decoder.keyDecodingStrategy = .convertFromSnakeCase
    return try decoder.decode(DescribedPackage.self, from: json)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages