Swiftpack.co - to4iki/Todotxt as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by to4iki.
to4iki/Todotxt 0.1.0
todo.txt parser
⭐️ 0
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/to4iki/Todotxt.git", from: "0.1.0")

Todotxt

CI Swift 5 MIT License

parser of todo.txt format

https://github.com/todotxt/todo.txt

Usage

build Todo object

let input = "x (A) title +project @context due:2022-09-25"
let todo = TodoBuilder.build(input: input)

Sorted

sort TodoList in order of TodoList.SortType

extension TodoList {
  public enum SortType {
    case dueDate
    case priority
    case project
    case context
  }
}

let inputs = """
  x (A) title_1 +project @context due:2022-09-25
  (C) title_2 due:2022-09-26
  (B) title_3 +project due:2022-09-27
  (C) title_4 @context due:2022-09-28
  (A) title_5 due:2022-09-29
""".components(separatedBy: "\n")

let todoList = TodoBuilder.build(inputs: inputs)
todoList.sorted(by: .priority).compactMap(\.title)
// title_1, title_5, title_3, title_2, title_4

License

Todotxt is released under the MIT license.

GitHub

link
Stars: 0
Last commit: 24 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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