Skip to content

Instantly share code, notes, and snippets.

@pedrommcarrasco
Last active September 5, 2019 09:11
Show Gist options
  • Save pedrommcarrasco/cbe1665e7c921c107e7bd74306691289 to your computer and use it in GitHub Desktop.
Save pedrommcarrasco/cbe1665e7c921c107e7bd74306691289 to your computer and use it in GitHub Desktop.
How To Display Your Dependencies - Parser
struct Acknowledgments: Decodable {
let specs: [Framework]
}
struct Framework: Decodable {
let name: String
let homepage: String
let version: String
}
struct AcknowledgmentsParser {
static var acknowledgments: Acknowledgments? { // Could be a Result if you care about errors
guard let path = Bundle.main.path(forResource: "Pods-YOUR_TARGET-metadata", ofType: "plist") else { return nil }
do {
let data = try Data(contentsOf: URL(fileURLWithPath: path))
let decoder = PropertyListDecoder()
return try decoder.decode(Acknowledgments.self, from: data)
} catch {
return nil
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment