Swiftpack.co - Indexing-Your-Heart/JensonKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Indexing-Your-Heart.
Indexing-Your-Heart/JensonKit 0.1.0-alpha2
Dialogue parsing for games
⭐️ 0
🕓 37 weeks ago
iOS macOS tvOS macCatalyst
.package(url: "https://github.com/Indexing-Your-Heart/JensonKit.git", from: "0.1.0-alpha2")

JensonKit

JensonKit is a Swift package for reading and writing files in the Jenson dialogue format. The Jenson format is used interally for the dialogue in Indexing Your Heart.

Getting started

Quickstart: Add to an Xcode project

JensonKit can be added directly into Xcode. In Xcode 13 or later, go to File > Add Packages..., then paste the URL to this repository.

Note
For older versions of Xcode, this menu may be located in File >  Swift Packages > Add Package Dependency....

Afterwards, you can interact with JensonKit via import JensonKit.

Building from source

Required Tools

  • Xcode 13 or later
  • Swift 5.6 or later

Clone the repository using git clone or gh repo clone, then open the project in Xcode or run swift build.

Example Usage

Reading a Jenson file

do {
    let fileContents = try JensonReader(fileURLWithPath: "Test.jenson").decode()
    for event in fileContents.timeline {
        print(\(event.who): \(event.what))
    }
} catch {
    print("Couldn't read the file.")
}

Writing a Jenson file

let exampleEvent = JensonEvent(type: .comment, who: "Tom", what: "Hello, world!", question: nil)
let fileContents = JensonFile(version: 1, timeline: [exampleEvent])
do {
    let writer = JensonWriter(contentsOf: fileContents)
    try writer.write(to: "Test.jenson")
} catch {
    print(error.localizedDescription)

License

JensonKit is non-violent software licensed under the Cooperative Non-violent Public License, v7 or later. You can read your rights in the provided LICENSE.md file or at https://git.pixie.town/thufie/npl-builder/src/branch/main/cnpl.md.

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v0.1.0-alpha2
37 weeks ago

What's new:

  • Updates format to use compression. Enabled by default.
  • Updates Jenson format to v2.
    • Includes new story and application fields in the manifest file.
    • Introduces new refressh event type and JensonRefreshContent.
  • Updates existing structs to conform to Identifiable, Equatable, and Hashable.
  • Introduces new JensonWriter.data() method to write to a Data object.

Full Changelog: https://github.com/Indexing-Your-Heart/JensonKit/compare/0.1.0-alpha...0.1.0-alpha2

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics