When I write poetry, I like to write a bunch of alternative lines, and swap them in to see how it sounds. I usually use my notebook, because this allows me to cross things out, write over, fill in random space with comments and ideas. But I loose this freedom when I type final drafts into a text editor. I love to see the black text on the white page of the screen, I love the formality of it, but I find that text editors don't give me enough freedom to continue to draft and comment on the poem. Further, most text editors have lots of formatting options that are really just a distraction to writing poetry.
The main challenge was intercepting all of the typing and cursor movement events. When the cursor is on a given line, the draft view (which opens in on the right side) will show comments you've made on that specific line. So I needed to listen to any cursor changes and then update the text accordingly. There's also a summary view of all the comments on individual lines, this had to be updated.
Getting the line numbers in on the text view was quite tricky, but I was able to copy some open source code (with an MIT license) and modify it to do what I needed to do - that code is here, https://github.com/raphaelhanneken/line-number-text-view/tree/master, and also cited in my source code.
I'm planning to build file export/import next to the app, so that poems and notes tied to specific lines can be saved in markdown and opened later (or in a different text editor). This will be a big challenge, but I didn't quite get to it.
Built With
- appkit
- swift

Log in or sign up for Devpost to join the conversation.