Convenience initializer must delegate with self.init error for custom UIView initializer
Solution 1:
This error indicates, we shouldn't chain convenience initializer with its super class initializer.
We need to call following method
super.init(frame: frame)
inside this method
override init(frame: CGRect)
This is what it looks like:
convenience init(frame: CGRect, tutorProfileImageURL: String?) {
self.init(frame: frame)
self.tutorProfileImageURL = tutorProfileImageURL
}
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
Check difference between Convenience and Designation initializers
Solution 2:
The convenience initializer uses his init for it. So just change the last line, to self.init
convenience init(frame: CGRect, tutorProfileImageURL: String?) {
self.init(frame: frame)
self.tutorProfileImageURL = tutorProfileImageURL
}