I create a store through xib:
let cShop = UINib(nibName: "connectedShop", bundle: nil).instantiateWithOwner(nil, options: nil)[0] as! connectedShop
This store has assigned this custom class:
import Foundation
import UIKit
class connectedShop : UIView{
@IBOutlet weak var bannerViewHight: NSLayoutConstraint!
@IBOutlet weak var bannerViewTop: NSLayoutConstraint!
@IBOutlet weak var bannerViewLeft: NSLayoutConstraint!
@IBOutlet weak var bannerViewRight: NSLayoutConstraint!
@IBOutlet weak var banerDiscount: UIImageView!
@IBOutlet weak var bannerImageShop: UIImageView!
@IBOutlet weak var bannerTitle: UILabel!
@IBOutlet weak var bannerDescription: UILabel!
@IBOutlet weak var bannerButton: UIButton!
@IBAction func bannerButtonAction(sender: UIButton) {
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
}
And from the code, I call this store as follows:
let cShop = UINib(nibName: "connectedShop", bundle: nil).instantiateWithOwner(nil, options: nil)[0] as! connectedShop
cShop.bannerTitle.text = "shopTitle"
shopContainer.addSubview(cShop)
cShop.bannerViewLeft.constant = 0
cShop.bannerViewRight.constant = 0
cShop.bannerViewTop.constant = 0
When I set the property bannerTitle.text, my application continues and debugs, I see that this socket is initialized, but there are no restrictions, and when the compiler is on the line that assigns a constant, it always causes the same error:
fatal error: unexpectedly found nil while unwrapping an Optional value
debugging I saw that there is one output that is initialized:

Does anyone know why this might happen?
These are my connections:

source
share