https://github.com/dankinsoid/simplecoders
Simple protocols to write custom Encoders and Decoders
https://github.com/dankinsoid/simplecoders
Last synced: 10 months ago
JSON representation
Simple protocols to write custom Encoders and Decoders
- Host: GitHub
- URL: https://github.com/dankinsoid/simplecoders
- Owner: dankinsoid
- License: other
- Created: 2022-01-22T18:04:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-01T07:37:58.000Z (over 1 year ago)
- Last Synced: 2025-08-29T05:39:58.748Z (10 months ago)
- Language: Swift
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleCoders
## Description
This repository includes some useful tools for `Codable` protocol and data decoding.
## Usage
1. `PlainCodingKey`
Simple `CodingKey` struct.
2. Type reflection for `Decodable` types
```swift
let properties: [String: Any.Type] = Mirror.reflect(SomeType.self)
//or Mirror(SomeType.self).children
```
9. Tools for creating custom encoders/decoders
Based on similar logic when writing different encoders/decoders `DecodingUnboxer` and `EncodingBoxer` protocols were implemented.
Examples of usage are all encoders in decoders in this repo.
## Installation
1. [Swift Package Manager](https://github.com/apple/swift-package-manager)
Create a `Package.swift` file.
```swift
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "SomeProject",
dependencies: [
.package(url: "https://github.com/dankinsoid/SimpleCoders.git", from: "1.5.0")
],
targets: [
.target(name: "SomeProject", dependencies: ["SimpleCoders"])
]
)
```
```ruby
$ swift build
```
2. [CocoaPods](https://cocoapods.org)
Add the following line to your Podfile:
```ruby
pod 'SimpleCoders'
```
and run `pod update` from the podfile directory first.
## Author
Voidilov, voidilov@gmail.com
## License
VDCodable is available under the MIT license. See the LICENSE file for more info.