This piece of code bellow used to work fine in Xcode 6 beta 5:
func fitText(){
let size = (self.text as NSString).sizeWithAttributes([NSFontAttributeName:self.font]) //Errors here
self.frame.size = size
}
Now it gives the following errors on the second line:
'UIFont' is not a subtype of 'NSDictionary'
Cannot convert the expression's type '$T6' to type 'UIFont'
When I split it into
let dict = [NSFontAttributeName:self.font]
let size = (self.text as NSString).sizeWithAttributes(dict) //Even stranger errors go here
xcode says:
'UIFont' is not a subtype of 'NSDictionary'
Cannot convert the expression's type '[NSString : UIFont]' to type 'CGSize'
What has changed with swift in beta 7 or 6 that it breaks the code?