![](/img/trans.png)
[英]`NSDictionary` is not implicitly convertible to `[NSObject : AnyObject]`
[英]'NSMutableSet' is not implicitly convertible to 'Set<NSObject>'
我正在使用coreplot在我的應用程序中繪制圖形。 當我嘗試分配X軸標簽或主要刻度位置時,盡管NSMutableSet
轉換為NSObject Type的設置,但仍NSMutableSet
錯誤。 這是我編寫代碼的方式:
xAxis.axisLabels = xAxisLabels as Set<NSObject>
xAxis.majorTickLocations = xMajorTickLocations as Set<NSObject>
引發的錯誤如下
'NSMutableSet' is not implicitly convertible to 'Set<NSObject>'; did you mean to use 'as' to explicitly convert
盡可能使用本機Swift類型而不是Foundation集合。 這消除了鑄造的需要。
var xAxisLabels = Set<CPTAxisLabel>()
var xMajorTickLocations = Set<NSNumber>()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.