3

I recently updated my Xcode from Xcode 7 beta 4 to Xcode 7 beta 5 and began to have an error that wasn't present before. That being: "AllocWithZone is unavailable in Swift: use Object Initializers instead."

Here is the code where the error is found:

public func copyWithZone(zone: NSZone) -> AnyObject {
    let copy = self.dynamicType.allocWithZone(zone) as ChartDataSet
    copy.colors = colors
    copy.label = self.label
    return copy
}

What do I substitute in place of ".allocWithZone" so that it utilizes an Object Initializer instead of this Obj C component?

Bret Smith
  • 88
  • 10

1 Answers1

5

I used this, and the iOS Charts library works for me:

let copy=self.dynamicType.initialize() as! ChartDataEntry
Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
Zirk Kelevra
  • 230
  • 1
  • 6