Sha256: d622f9d8e306df1c336900e156e927992be3244847c171f78bd589f66ce31e1a
Contents?: true
Size: 894 Bytes
Versions: 113
Compression:
Stored size: 894 Bytes
Contents
import PackageDescription import Foundation let path = FileManager.default.currentDirectoryPath + "/config.json" var allProblems = [String]() if let jsonData = try? Data(contentsOf: URL(fileURLWithPath: path), options: Data.ReadingOptions.mappedIfSafe) , let json = try? JSONSerialization.jsonObject(with: jsonData, options: []) , let jsonDict = json as? [String: Any], let exercisesDict = jsonDict["exercises"] as? [[String: Any]], let exercises = exercisesDict.map({ $0["slug"] }) as? [String], let deprecated = jsonDict["deprecated"] as? [String] { allProblems += exercises allProblems += deprecated } else { print("Could not parse config.json at \(path)") } let dependencies = allProblems.map { Package.Dependency.Package(url: "./exercises/\($0)/", majorVersion: 1) } let package = Package( name: "xswift", dependencies: dependencies )
Version data entries
113 entries across 113 versions & 1 rubygems