Automattic / Automattic-Tracks-iOS

Client library for tracking user events for later analysis
GNU General Public License v2.0
43 stars 12 forks source link

Use `key, value` instead of `$0` in Dictionary `.forEach` for readability #219

Closed mokagio closed 2 years ago

mokagio commented 2 years ago

This is a bit of a personal take, so feel free to reject if you disagree.

It took me "a while" to understand that events was a Dictionary when reading events.forEach { ... $0.key ... }. I think explicitly calling the parameter key, value makes for easier to read code.

Incidentally, key, value is the approach used elsewhere in the same file, so this also makes the code consistent.