JOP is the Json organization program. It can run on any platform that supports Swift.

Related tags

JSON JOP
Overview

JOP

JOP is a program organized in JSON files. It is based on Swift, provides a syntax similar to Swift, and has the same strong security as Swift. This project only provides JOP running call interface, you need to call it in Swift. JOP is still undergoing rapid development, and destructive changes will be more obvious.

Run

The following code needs to be called in Swift.

public static func run(_ text: String, filePath: URL, errorHandle: ((Error) -> Void)? = nil) -> Processer?
public static func run(_ dict: [String : Any], filePath: URL, errorHandle: ((Error) -> Void)? = nil) -> Processer?
  • text: JSON file to be parsed
  • dict: Dict to be parsed
  • filePath: The path of the program at startup
  • errorHandle: Called when the program encounters an error

JOP.run supports calling through a dictionary([String : Any]), or through a JSON string. JOP.run return a Processer.

Use start() to start the processer

JOP.run("", filePath: URL(fileURLWithPath: "")) { error in
    print(error)
}?
.start()

start() will use the Runner internally to start itself.

Callback

The callback function acts on the Processor!

OnPrint

Callback function triggered when the program calls print()

JOP.run(run, filePath: URL(fileURLWithPath: "")) { error in
    print(error)
}?
.onOutPut{ outPut in
    print(outPut.text)
}
.start()

output is a type instance of OutPut.

OutPut stores the text, text color, bold and other information.

public struct OutPut {
    var color: String?
    var bold: Bool
    var text: String
}

Example

let run: [String : Any] = [
    "main" : [
        [
            "command": "define",
            "name": "theFirstValue",
            "type": "String"
        ],
        [
            "command": "assignment",
            "name": "theFirstValue",
            "value": "hello, world!"
        ],
        [
            "command": "call",
            "type": "func",
            "name": "print",
            "passBy": "$theFirstValue"
        ],
        [
            "command": "assignment",
            "name": "theFirstValue",
            "value": "hello, JOP!"
        ],
        [
            "command": "call",
            "type": "func",
            "name": "print",
            "passBy": "$theFirstValue"
        ]
    ]
]

JOP.run(run, filePath: URL(fileURLWithPath: "")) { error in
    print(error)
}?
.onOutPut{ outPut in
    print(outPut.text)
}
.start()

Ouput:

hello, world!
hello, JOP!
You might also like...
This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

FlatBuffersSwift Motivation This project brings FlatBuffers (an efficient cross platform serialization library) to Swift. One minute introduction Ther

Codable code is a Swift Package that allows you to convert JSON Strings into Swift structs

Codable code is a Swift Package that allows you to convert JSON Strings into Swift structs.

Implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top of Swift's Codable implementations.

DynamicCodableKit DynamicCodableKit helps you to implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top

AlamofireObjectMappe - An Alamofire extension which converts JSON response data into swift objects using ObjectMapper

AlamofireObjectMapper An extension to Alamofire which automatically converts JSON response data into swift objects using ObjectMapper. Usage Given a U

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Freddy - A reusable framework for parsing JSON in Swift.
Freddy - A reusable framework for parsing JSON in Swift.

Why Freddy? Parsing JSON elegantly and safely can be hard, but Freddy is here to help. Freddy is a reusable framework for parsing JSON in Swift. It ha

[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021
[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021

🚨 Deprecation Notice 🚨 Gloss has been deprecated in favor of Swift's Codable framework. The existing Gloss source is not going away, however updates

HandyJSON is a framework written in Swift which to make converting model objects to and from JSON easy on iOS.

HandyJSON To deal with crash on iOS 14 beta4 please try version 5.0.3-beta HandyJSON is a framework written in Swift which to make converting model ob

Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift.

Himotoki Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift. This library is highly inspired by the popular Swift JSON parsin

Releases(Beta0.0.1)
Owner
Underthestars-zhy
iOS software developer
Underthestars-zhy
JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift.

JSEN /ˈdʒeɪsən/ JAY-sən JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift. A JSON, as defined in the EC

Roger Oba 8 Nov 22, 2022
Swift-json - High-performance json parsing in swift

json 0.1.4 swift-json is a pure-Swift JSON parsing library designed for high-per

kelvin 43 Dec 15, 2022
JSON-Practice - JSON Practice With Swift

JSON Practice Vista creada con: Programmatic + AutoLayout Breve explicación de l

Vanesa Giselle Korbenfeld 0 Oct 29, 2021
Ss-json - High-performance json parsing in swift

json 0.1.1 swift-json is a pure-Swift JSON parsing library designed for high-per

kelvin 43 Dec 15, 2022
Swift parser for JSON Feed — a new format similar to RSS and Atom but in JSON.

JSONFeed Swift parser for JSON Feed — a new format similar to RSS and Atom but in JSON. For more information about this new feed format visit: https:/

Toto Tvalavadze 31 Nov 22, 2021
JSONNeverDie - Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die

JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very important part of Pitaya.

John Lui 454 Oct 30, 2022
JSONHelper - ✌ Convert anything into anything in one operation; JSON data into class instances, hex strings into UIColor/NSColor, y/n strings to booleans, arrays and dictionaries of these; anything you can make sense of!

JSONHelper Convert anything into anything in one operation; hex strings into UIColor/NSColor, JSON strings into class instances, y/n strings to boolea

Baris Sencan 788 Jul 19, 2022
Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps.

JSONModel - Magical Data Modeling Framework for JSON JSONModel allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS

JSONModel 6.9k Dec 8, 2022
Library of Swiftui Views conforming to Codable, meaning we can produce JSON driven UI!

CodableView Library of Swiftui Views conforming to Codable, meaning we can produce JSON driven UI! Adding a CodableView Type Create View that conforms

Daniel Bolella 3 Apr 2, 2022
Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps.

JSONModel - Magical Data Modeling Framework for JSON JSONModel allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS

JSONModel 6.8k Nov 19, 2021