Keyboard layout specific. Macs with their default English layout use “option-shift-dash” which is really easy to remember (and relatively discoverable, as such things go) which is why using proper m-dashes (not just double-dashes) used to be a strong indicator a poster was using a Mac, before LLMs took the character over.

On iOS you type it by pressing dash and holding until alternative options come up, same way you type e.g. accented characters.

You can also just type two "-" minuses on iOS. So "--" will auto-convert to "—".