Method to Extension

Suppose you have some Kotlin function that takes an argument and you want to convert it to an extension. There’s a keyboard shortcut for that.

Place the cursor at the function argument and press alt-Enter (Windows).

Then click “Convert parameter to receiver”.

comments powered by Disqus