I\'ve been working on an app on and off for a few months starting with the first XCode 6/iOS 8 beta release. One of my favorite features added is live rendering, made possib
For me, this error turned out to be due to a blocking call to a sqlite database (using CoreData) in one of my @IBInspectable properties.
My code originally queried the database and then used dispatchAsync
to set the value of a label based on the results of the query. I changed it so that the query was also launched in the dispatchAsync
block. The error immediately went away.
If anyone else is having trouble with this error, I suggest checking out any code that would be executed during the design phase (constructors or computed properties marked with @IBInspetable). If there is any blocking code (network operations, database access, etc.), it might be causing the timeout error. Hope this helps.
Had the same problem but to a glance at this great article. It solved my problem.
http://nshipster.com/ibinspectable-ibdesignable/
In short
To get these options in xcode
Make a property like this:
@IBInspectable var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = cornerRadius
layer.masksToBounds = cornerRadius > 0
}
}
Apparently I needed to override init(frame: CGRect)
along with init(code: NSCoder)
.
Got it working! If anyone could care to explain why this wasn't working, that would be great. Otherwise, I'm fine here.
Although this might not really be a helpful answer, I found that after looking for a solution for this for half an hour a simple close and re-open of Xcode did the trick - if you haven't tried this yet give it a go!
Make sure you override prepareForInterfaceBuilder to solve this.
@IBDesignable
class SomeView: UITableView {
@IBInspectable var something: Int? { didSet { setup() } }
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
override init(frame: CGRect, style: UITableViewStyle) {
super.init(frame: frame, style: style)
setup()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
setup()
}
func setup() {
// do sth
}
}