All Projects β†’ Flight-School β†’ Anycodable

Flight-School / Anycodable

Licence: mit
Type-erased wrappers for Encodable, Decodable, and Codable values

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Anycodable

Codability
Useful helpers for working with Codable types in Swift
Stars: ✭ 125 (-84.59%)
Mutual labels:  encoding, decoding, codable
AnimatedGif
πŸ“Ό A high performance .NET library for reading and creating animated GIFs
Stars: ✭ 106 (-86.93%)
Mutual labels:  encoding, decoding
scure-base
Secure, audited & 0-deps implementation of bech32, base64, base32, base16 & base58
Stars: ✭ 27 (-96.67%)
Mutual labels:  encoding, decoding
Libmorton
C++ header-only library with methods to efficiently encode/decode Morton codes in/from 2D/3D coordinates
Stars: ✭ 373 (-54.01%)
Mutual labels:  encoding, decoding
sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-97.53%)
Mutual labels:  encoding, decoding
avro ex
An Avro Library that emphasizes testability and ease of use.
Stars: ✭ 47 (-94.2%)
Mutual labels:  encoding, decoding
Serpent
A protocol to serialize Swift structs and classes for encoding and decoding.
Stars: ✭ 281 (-65.35%)
Mutual labels:  encoding, decoding
DjvuNet
DjvuNet is a cross platform fully managed .NET library for working with Djvu documents which can run on Linux, macOS and Windows. Library has been written in C# and targets .NET Core v3.0 and .NET Standard v2.1 or later. We intend to provide DjVu document processing capabilities on par with DjVuLibre reference library (or even better).
Stars: ✭ 54 (-93.34%)
Mutual labels:  encoding, decoding
Hashids.net
A small .NET package to generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.
Stars: ✭ 470 (-42.05%)
Mutual labels:  encoding, decoding
Scodec
Scala combinator library for working with binary data
Stars: ✭ 709 (-12.58%)
Mutual labels:  encoding, decoding
Pbf
A low-level, lightweight protocol buffers implementation in JavaScript.
Stars: ✭ 618 (-23.8%)
Mutual labels:  encoding, decoding
go-fixedwidth
Encoding and decoding for fixed-width formatted data
Stars: ✭ 64 (-92.11%)
Mutual labels:  encoding, decoding
cpp-bencoding
A C++ bencoding library supporting both decoding and encoding.
Stars: ✭ 20 (-97.53%)
Mutual labels:  encoding, decoding
velvet-video
Java library for encoding / decoding / muxing / demuxing video and audio in various formats
Stars: ✭ 32 (-96.05%)
Mutual labels:  encoding, decoding
universal-base64
Small universal base64 functions for node.js and browsers
Stars: ✭ 25 (-96.92%)
Mutual labels:  encoding, decoding
Xmorse
🌞 ~1.5Kb morse code library for all. δΈ€δΈͺζ”―ζŒ Unicode δΈ­ζ–‡ζ‘©ζ–―ε―†η ηΌ–η ηš„ Javascript 库。
Stars: ✭ 266 (-67.2%)
Mutual labels:  encoding, decoding
Flac
Free Lossless Audio Codec
Stars: ✭ 593 (-26.88%)
Mutual labels:  encoding, decoding
go-webp
Simple and fast webp library for golang
Stars: ✭ 91 (-88.78%)
Mutual labels:  encoding, decoding
d3coder
Chrome extension for encoding/decoding and hashing text on websites
Stars: ✭ 26 (-96.79%)
Mutual labels:  encoding, decoding
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (-43.77%)
Mutual labels:  encoding, decoding

AnyCodable

Build Status License Swift Version Cocoapods platforms Cocoapods compatible Carthage compatible

Type-erased wrappers for Encodable, Decodable, and Codable values.

This functionality is discussed in Chapter 3 of Flight School Guide to Swift Codable.

Installation

Swift Package Manager

Add the AnyCodable package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/Flight-School/AnyCodable",
        from: "0.4.0"
    ),
  ]
)

Then run the swift build command to build your project.

CocoaPods

You can install AnyCodable via CocoaPods by adding the following line to your Podfile:

pod 'AnyCodable-FlightSchool', '~> 0.4.0'

Run the pod install command to download the library and integrate it into your Xcode project.

Note The module name for this library is "AnyCodable" --- that is, to use it, you add import AnyCodable to the top of your Swift code just as you would by any other installation method. The pod is called "AnyCodable-FlightSchool" because there's an existing pod with the name "AnyCodable".

Carthage

To use AnyCodable in your Xcode project using Carthage, specify it in Cartfile:

github "Flight-School/AnyCodable" ~> 0.4.0

Then run the carthage update command to build the framework, and drag the built AnyCodable.framework into your Xcode project.

Usage

AnyEncodable

import AnyCodable

let dictionary: [String: AnyEncodable] = [
    "boolean": true,
    "integer": 1,
    "double": 3.141592653589793,
    "string": "string",
    "array": [1, 2, 3],
    "nested": [
        "a": "alpha",
        "b": "bravo",
        "c": "charlie"
    ]
]

let encoder = JSONEncoder()
let json = try! encoder.encode(dictionary)

AnyDecodable

let json = """
     {
         "boolean": true,
         "integer": 1,
         "double": 3.141592653589793,
         "string": "string",
         "array": [1, 2, 3],
         "nested": {
             "a": "alpha",
             "b": "bravo",
             "c": "charlie"
         }
     }
""".data(using: .utf8)!

let decoder = JSONDecoder()
let dictionary = try! decoder.decode([String: AnyDecodable].self, from: json)

AnyCodable

AnyCodable can be used to wrap values for encoding and decoding.

License

MIT

Contact

Mattt (@mattt)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].