SimpleCoders

main

Simple protocols to write custom Encoders and Decoders
dankinsoid/SimpleCoders

SimpleCoders

Description

This repository includes some useful tools for Codable protocol and data decoding.

Usage

  1. PlainCodingKey

Simple CodingKey struct.

  1. Type reflection for Decodable types
let properties: [String: Any.Type] = Mirror.reflect(SomeType.self)
//or Mirror(SomeType.self).children
  1. 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

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 build
  1. CocoaPods

Add the following line to your Podfile:

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.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 21:20:15 GMT-0900 (Hawaii-Aleutian Daylight Time)