It’s not a requirement, but it can be helpful if you do know how to code. Some UI designers never learn to code and get along just fine in the workforce. Others already have experience in coding, and it works to their advantage.
There are many different jobs that involve UI design. Some job descriptions will ask for coding experience, while others do not require it. Many entry-level UI jobs do not have expectations for coding, but growing in your career can often involve getting that extra coding training.