使用未声明的类型 'CPTMutableAxisLabelSet'

use of undeclared type 'CPTMutableAxisLabelSet'

我可以在pod的帮助下安装core plot 2.2。我想使用 swift 在 x 轴上设置自定义标签。为此,我编写了以下代码

let axisArray = ["Sun", "Mon", "Tues", "Weds", "Thurs", "Fri", "Sat"]
            let customLabel: CPTMutableAxisLabelSet = []
            let tickLocation: NSArray = [3, 6, 9, 12, 15, 18, 21]
            var labelLocation: Int = -1
            for var number in tickLocation {
                labelLocation += 1
                let newLabel = CPTAxisLabel.init(text: axisArray[labelLocation], textStyle: x.labelTextStyle)
                newLabel.tickLocation = number as! NSNumber
                newLabel.offset = x.labelOffset + x.majorTickLength
                newLabel.rotation = CGFloat(M_PI /  Double(4.0))
                customLabel.add(newLabel)
            }
            x.axisLabels = NSSet.init(array: (customLabel as AnyObject) as! [Any]) as! Set<CPTAxisLabel>

它给出编译器错误 "use of undeclared type 'CPTMutableAxisLabelSet'"。如果我尝试用 "NSMutableArray" 替换 "CPTMutableAxisLabelSet" 那么应用程序就会崩溃。谁能帮我如何在 swift.

中创建自定义标签

只用Swift个集合就简单多了。

var customLabels = Set<CPTAxisLabel>()
// create the custom labels and add them to the set
x.axisLabels = customLabels