I been trying to get to get up to speed with swift, and it not going very well for the moment.
I tried to make a custom UIview on a nib that basically has 2 labels to show date and month very simple. I set up the xib file attached the outlets set my file's owner to the custom class. same I do in objective-c.
I set up the init with coder and when I try and use the UINib to get the nib and set up my UI I get this crash.
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key centerDot.'
this is the faulty code (project URL below on github)
class func instanceFromNib() -> UIView {
return UINib(nibName: "ACDateView", bundle: nil).instantiateWithOwner(self, options: nil)[0] as UIView
}
required init(coder aDecoder: NSCoder) {
date = NSDate()
frameInset = UIEdgeInsetsZero
itemDistance = 0
direction = 0
self.view = ACDateView.instanceFromNib()
super.init(coder: aDecoder)
addSubview(view)
}
https://github.com/nissaba/TowLineDate
Also at the same time I was trying this live rendering that we can do now in xcode6 but that fails also saying that
file:///.../Base.lproj/Main.storyboard: error: IB Designables: Failed to update auto layout status: dlopen(ACDateView.framework, 1): no suitable image found. Did find: ACDateView.framework: mach-o, but wrong architecture
So I am guessing from my reading that I may be wrong to use the framework as I saw in some example on the net, or its just some thing. I tried with out the frame work I did get the same message.