parser of todo.txt format
https://github.com/todotxt/todo.txt
build Todo object
let input = "x (A) title +project @context due:2022-09-25"
let todo = TodoBuilder.build(input: input)
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
Todotxt is released under the MIT license.
link |
Stars: 0 |
Last commit: 3 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics