A Simple Tip for developers writing both Kotlin & Swift

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 vs Swift’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.

The setup looks like this for IntelliJ or Android Studio.
And it looks like this for AppCode.

Let me know in the comments if this helped, and if there are other cases you’ve run into!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.