Reputation: 2634
This is my code:
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
func commonInit() {
let mainBundle = Bundle.main
mainBundle.loadNibNamed("iconView", owner: self, options: nil)
addSubview(contentView)
contentView.frame = self.bounds
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
I copied it from step 8 in this tutorial that I've seen (I only changed the name in the code to my xib file: "iconView"). But for some reason it fails: I already tried all of the solutions in stackoverflow, but nothing helped me. Here is my xib file: I really don't know what to do. I'm using Xcode 12 beta 6, iOS 14 beta 6 UPDATE Okay, a lot of people saied in the comments of the tutorial that
This causes an infinite-loop calling commonInit().
So now I know what the issue is, but I still don't know how to solve it. Any ideas?
Upvotes: 2
Views: 627
Reputation: 8327
You probably have to remove Class from your View.
First select your View
(in your case iconView
):
and then clear whatever there is in the class
field:
Upvotes: 3