In your day to day programming, do you jump back and forth between writing Kotlin and Swift code as I do? You’ve also probably noticed that you develop muscle memory as you type the keywords. The two languages are quite similar and this lets me be quite productive in both. Yet, there is one set of keywords in particular that gets me every time: Kotlin’s val vsSwift’s let. I often end up typing let for Kotlin code, or val for Swift code.
Since I use jetBrains products for both languages (IntelliJ or Android Studio for Kotlin, and AppCode for Swift), I’ve been able to take advantage of their Live Templates feature to automatically and seamlessly correct me if I type the wrong keyword. Here’s what the setup looks like… Important to note that the ‘Expand with’ setting defaults to Tab, but I need it to be Space.
Let me know in the comments if this helped, and if there are other cases you’ve run into!