Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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"]),
]
)
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,40 @@ 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))
```


## Installation

### CocoaPods

SwiftDictionaryCoding is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
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
Expand Down