TIMEX TIMEX - 4 months ago 6x
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.


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