I'm developing my first pod file for a custom toast. I have designed the UIView in a .xib file. This works fine in the initial project, but when I copy those files to pod project, it shows
Thread 1: Exception: "Could not load NIB in bundle: 'NSBundle </Users/sameernawaz/Library/Developer/CoreSimulator/Devices/9FD32443-4431-480F-93B3-E1106D74E944/data/Containers/Bundle/Application/05EFC4C0-A60C-4A72-B23D-8575F0218B64/MotionToastView_Example.app> (loaded)' with name 'MTVibrant'"
I have tried adding these .xib files target -> copy bundle resource, but nothing helps. I'm not sure am I allowed to use xib files or should I code my UIView in Swift.
import UIKit
class MTVibrant: UIView {
@IBOutlet weak var headLabel: UILabel!
@IBOutlet weak var msgLabel: UILabel!
@IBOutlet weak var circleImg: UIImageView!
@IBOutlet weak var toastView: UIView!
@IBOutlet weak var circleView: UIView!
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
func commonInit() {
let viewFromXib = Bundle.main.loadNibNamed("MTVibrant", owner: self, options: nil)![0] as! UIView
viewFromXib.frame = self.bounds
addSubview(viewFromXib)
}
}