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: magic
and 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 paths
property.
Commits Made
- Add toolbar with highlighter tool toggle button
- Toggle button for current highlighter tool
- Draw manual brush strokes
Tickets Closed
Tickets Created
None.
Project Stats
- Sessions Completed
- 18
- Days Since Start
- 45
- Issues Closed
- 25
- Issues Open
- 11
- Percent Complete
- 69.4%
Replay
Watch this session on YouTube: