Is there a way to automatically change my keyboard language when I switch between windows on macOS? For example, when I use the Messages app in which I use one keyboard, and in Xcode, I use only English keyboard. Can macOS switch my keyboard to English when I make the Xcode window active?
Follow these steps to changing your keyboard language dynamically:


Open up System Preferences. This should be in your /Applications folder.
Click on "Keyboard":


Click on the "Input Sources" tab:


You should see a checkbox titled "Automatically switch to a document's input source". Check that checkbox and you're done!