Latest 1.1.1
Homepage https://github.com/Robindiddams/ecoji-swift
License MIT
Platforms ios 8.0, osx 10.10, watchos 2.0, tvos 9.0
Authors

Ecoji-Swift

CocoaPods Compatible
Swift Package Manager compatible

A Swift 5 implementation of the Ecoji encoding standard.

Provides a library for encoding and decoding data as a base-1024 sequence of emojis

Install

  pod 'Ecoji'

Usage

Works a lot like a JSONEncoder/Decoder

Encoding

Encode is implemented for Data or String inputs

import Ecoji
let encoder = EcojiEncoder()
let emojiString = encoder.encode(from: "Hello World!")
print(emojiString)
// "🏯🔩🚗🌷🍉👇🦒🕊👡📢☕☕"

Decoding

You can decode into Data like this:

let decoder = EcojiDecoder()
do {
  let data = try decoder.decode(string: "🏯🔩🚗🌷🍉👇🦒🕊👡📢☕☕"
  print(data)
  // "12 bytes"
} catch let err as DecodingError {
  print(err)
}

Theres also a convenience method for reconstruction utf strings from the data:

let decoder = EcojiDecoder()
do {
  let data = try decoder.decodeToString(string: "🏯🔩🚗🌷🍉👇🦒🕊👡📢☕☕"
  print(data)
  // "Hello World!"
} catch let err as DecodingError {
  print(err)
}

TODO:

  • [x] Decode/Encode
  • [x] Tests
  • [ ] Linux compatibility
  • [x] swift package manager
  • [x] cocoa pod

Contribution

PRs welcome!

check test cases with swift test

License

Like the rust implementation this program is licensed under either of

at your option.

Latest podspec

{
    "name": "Ecoji",
    "version": "1.1.1",
    "summary": "Provides a library for encoding and decoding data as a base-1024 sequence of emojis.",
    "description": "A Swift 5 implementation of the [Ecoji](https://github.com/keith-turner/ecoji) encoding standard.nnProvides a library for encoding and decoding data as a base-1024 sequence of emojis",
    "homepage": "https://github.com/Robindiddams/ecoji-swift",
    "license": {
        "type": "MIT",
        "file": "LICENSE-MIT"
    },
    "authors": {
        "Robin Diddams": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Robindiddams/ecoji-swift.git",
        "tag": "1.1.1"
    },
    "swift_versions": "5.0",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source_files": "Sources/Ecoji/**/*",
    "swift_version": "5.0"
}

Pin It on Pinterest

Share This