How to Create Round Buttons Using @IBDesignable on iOS 11


Buttons in Xcode Storyboards require a bit of work to customize, especially if you want a solid background color and an easy to edit corner radius.

This is a companion discussion topic for the original entry at


Dan Stenmark a former Apple employee shared the following:

cornerRadius is notoriously nasty on the GPU. There are situations when it really is the only option, but it should be avoided when possible.

Also, I’ve actually been moving away from sharedInit() and over to putting my view setup code in willMoveToWindow. While it does mean you have to write the code in an idempotent way (in case said view is repeatedly added and removed), you no longer have to muck around with multiple init methods.