class RoundImage: UIImageView { override func awakeFromNib() { super.awakeFromNib() setupView() } ... func setupView() { self
When this code gets run the view hasn't been sized yet, so the width is incorrect. Try putting a listener on frame:
override var frame : CGRect { didSet { layer.cornerRadius = frame.size.width / 2 } }