diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..0e92f41 --- /dev/null +++ b/Package.swift @@ -0,0 +1,29 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SwiftDictionaryCoding", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "SwiftDictionaryCoding", + targets: ["SwiftDictionaryCoding"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "SwiftDictionaryCoding", + dependencies: [], + path: "SwiftDictionaryCoding/Classes"), + // .testTarget( + // name: "SwiftDictionaryCodingTests", + // dependencies: ["SwiftDictionaryCoding"]), + ] +) diff --git a/README.md b/README.md index d18673a..6788fcb 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ struct Event: Codable { let event = Event(id: 1, eventName: "Christmas", location: nil, price: 10) let encoder = DictionaryEncoder() -let dict = try encoder.encode(event) +let dict = try encoder.encode(event) ``` ### Decoding ```Swift -let dict: [String: Any] = ["id": 1, "eventName": "Christmas", "price": 10] +let dict: [String: Any] = ["id": 1, "eventName": "Christmas", "price": 10] let decoder = DictionaryDecoder() let event = try decoder.decode(Event.self, from: dict)) ``` @@ -32,6 +32,8 @@ let event = try decoder.decode(Event.self, from: dict)) ## Installation +### CocoaPods + SwiftDictionaryCoding is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile: @@ -39,6 +41,18 @@ it, simply add the following line to your Podfile: pod 'SwiftDictionaryCoding' ``` +### Swift Package Manager + +SwiftDictionaryCoding is available through [Swift Package Manager](https://swift.org/package-manager/). + +Add the following dependency in your Package.swift to install: + +```swift +dependencies: [ + .package(url: "https://github.com/ashleymills/SwiftDictionaryCoding.git", from: "1.0.0") +] +``` + ## Author ashleymills, ashleymills@mac.com