dankinsoid/SimpleCoders
Simple protocols to write custom Encoders and Decoders
Description
This repository includes some useful tools for Codable protocol and data decoding.
Usage
PlainCodingKey
Simple CodingKey struct.
- Type reflection for
Decodabletypes
let properties: [String: Any.Type] = Mirror.reflect(SomeType.self)
//or Mirror(SomeType.self).children- 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
Create a Package.swift file.
// 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"])
]
)$ swift buildAdd the following line to your Podfile:
pod 'SimpleCoders'and run pod update from the podfile directory first.
License
VDCodable is available under the MIT license. See the LICENSE file for more info.
Package Metadata
Repository: dankinsoid/SimpleCoders
Stars: 0
Forks: 0
Open issues: 0
Default branch: main
Primary language: swift
License: Other
README: README.md