Swiftpack.co - mui-z/EffectiveNovelCore as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mui-z.
mui-z/EffectiveNovelCore 1.2.0
This is novel text parse and stream package.
⭐️ 2
🕓 14 weeks ago
iOS macOS
.package(url: "https://github.com/mui-z/EffectiveNovelCore.git", from: "1.2.0")

workflow status License Swift Twitter

Effective Novel Core

This is novel text parse and provide display event stream package.


This is novel engine.

This effectively helps to display the characters of the novel.  

This lib doesn't include UI layer. This only provides parse and output stream display event. (Example of use: EffectiveNovelReader)

Also, this lib is not optimized novel game, because this doesn't have if functioned, macro, subroutine.

If you use it for such a purpose, please parse it each time on the application side to use it.


demo: EffectiveNovelReader

<img style="max-width:100%;" src=https://user-images.githubusercontent.com/93278577/199856220-e8560b14-5e93-431d-8afc-3fe454690d46.gif?raw=true width=300 />


Use tags to control how they are displayed.

This syntax is based on Tyranoscript.

Syntax Tags

Tags must be enclosed in [].    

When commenting out, put # at the beginning.
If you want to use #, write \\#

tag DisplayEvent description
n .newline newline
tw .tapWait tap wait
twn .tapWaitAndNewline tap wait and newline
cl .clear clear
sleep duration=xxxx .sleep(duration: Double) sleep for the specified time. duration unit is milliseconds.
delay speed=xxxx .delay(speed: Double) change delay character displayed speed. speed unit is milliseconds.
setDefaultDelay speed=xxxx .setDefaultDelay(speed: Double) change default delay character displayed speed. speed unit is milliseconds.
resetDelay .resetDelay reset delay speed
e .end stop script novel end point

Example Novel Script

# Sample Script
tap waiting and newline[twn]

[cl] cleared text.

very fast stream after this text[delay speed=2][n]


[resetDelay]reset delay speed.[n]

end. [e]


State Flow

    direction LR
    [*] --> loadWait
    loadWait --> prepare: load
    prepare --> running: start
    running --> pause: pause
    pause --> running: resume
    running --> loadWait: interrupt
    pause --> loadWait: interrupt

Sample Code

// 1. get `NovelController` instance
let controller = NovelController()

// 2. load raw novel text
let result: ValidateResult<EFNovelScript, [ValidationError]> = controller.load(rawText: rawText)

let novelScript: EFNovelScript

switch result {
case .valid(let script):
    novelScript = script
case .invalid(let errors):
    // handle error.

// 3. start() and listening stream
controller.start(script: novelScript)
          .sink { event in
              switch event {
              case .character(let char):
              // and any command handling
          .store(in: &cancellables)

// (4.) show text until wait tag

// (5.) pause stream.

// (6.) resume from pause
// If you want to start from any index number, you can use `controller.resume(at: 100)`

// (7.) interrupt



  • ☐ value input
  • ☑ novel text validator
  • ☑ rearchitecture
  • ☐ Swift-DocC
  • ☑ comment out syntax


EffectiveNovelCore is licensed under the MIT License


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

Release Notes

14 weeks ago

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