Swift Extensions Lacks @IBDesignable And @IBInspectable

@IBDesignable and @IBInspectable allows the developers to view their live rendering of their custom  controls. Recently, I had the need to make the rounded corners for the UIButton control. I thought instead of making a subclass of UIButton why not utilize the power of extension methods. 

Here is the implementation: 

import UIKit

extension UIButton {
    public var cornerRadius :CGFloat {
        set { layer.cornerRadius = newValue }
        get {
            return layer.cornerRadius

Simple! The new property cornerRadius even appears in the Xcode properties window where I can adjust it. Unfortunately, the changes to the cornerRadius property are not rendered in real time but only when you run the app. 

Upon further investigation I found out that currently, the @IBDesignable and @IBInspectable live rendering is only supported on custom controls using subclasses. Hopefully, this feature will be extended to the Swift extensions in the future.