Having a callback makes it unclear as to whether the function is async (it's not). All of the callers expect it to be sync.
Created attachment 435458 [details] Patch
Comment on attachment 435458 [details] Patch I thought about this some more, and I'm concerned it trades one confusing construct for another, less common, confusing construct. The call sites at first glance now read as loops, which to me invokes the question "Why does this work need to be done more than once", a question that much like the sync/async situation can only really be answered by a trip to the definition of `WI.ImageUtilities.scratchCanvasContext2D`. I enjoy this solution from a technical perspective, but I'm not sure it meets the stated goal in the changelog of making these call sites clearer. It's just unclear in a different way.
Yeah FWIW this is kinda a "hack" of sorts 😅 I personally found that the loop looked better than a callback, but that's just me.
<rdar://problem/82148919>