TIMEX TIMEX - 1 year ago 130
iOS Question

How can I subclass UIView?

class ReplyContent: UIView {
var body: String?
var image: UIImage?

convenience init(body: String?, image: UIImage?){
self.body = body
self.image = image

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")


The error states: "Cannot invoke ReplyContent.init with no arguments.

Answer Source

You can't just do UIView.init() with no arguments. You need UIView.init(frame:) or UIView.init(coder:).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download