Misc macOS code cleanups and minor fixes
This contains mostly code cleanup and changes to fast iteration (for … in
loops).
Additionally a quite important fix for an assertion that could be caused by invalid index
to count comparison, fixed by macosx: Fix off-by-one in reload logic
@fkuehne Some clarifications about the logic in reloadDataForNotification
would be
appreciated as I am having a bit trouble to understand what is supposed to happen there.