Black Highlighter — May 15th, 2019
After all of the excitement of the last few sessions, it’s time to slow things down a bit. During this session, I added a different way to redact items in text: the manual highlighter. Unlike the “magic” highlighter which uses the Vision framework to detect text, the manual highlighter just draws brush strokes everywhere that’s been selected.
Doing that feature was pretty easy; the tricky part was exposing a UI for it! First, I had to add a toolbar, which involved rewriting part of our
NavigationController class to set custom navigation and toolbar classes. Inside these classes, I was able to set styling. Setting the toolbar to opaque was required to get it to stop covering the bottom part of the editing view. After creating the toolbar class, it was pretty easy to put a toolbar item in it—just text at that point.
To get the toolbar button to have any effect, I needed to represent the current tool selection state. To do this, I created a new enum:
HighlighterTool, with two cases:
manual. A property on
PhotoEditingView let it know what tool was current. From there, it was easy to create two different versions of the
handleBrushStroke method, based on the current tool.
Lastly, the actual redaction. This was pretty easy: just pass the raw path in
init, and return that from the
- Add toolbar with highlighter tool toggle button
- Toggle button for current highlighter tool
- Draw manual brush strokes
- Sessions Completed
- Days Since Start
- Issues Closed
- Issues Open
- Percent Complete
Watch this session on YouTube: