diff --git a/Source/Charts/Charts/ChartViewBase.swift b/Source/Charts/Charts/ChartViewBase.swift index 02742d915e..cfa7094cdf 100644 --- a/Source/Charts/Charts/ChartViewBase.swift +++ b/Source/Charts/Charts/ChartViewBase.swift @@ -13,8 +13,12 @@ import Foundation import CoreGraphics -#if !os(OSX) - import UIKit +#if canImport(UIKit) +import UIKit +#endif + +#if canImport(AppKit) +import AppKit #endif @objc diff --git a/Source/Charts/Components/AxisBase.swift b/Source/Charts/Components/AxisBase.swift index 83db26b62c..8e5ed766ce 100644 --- a/Source/Charts/Components/AxisBase.swift +++ b/Source/Charts/Components/AxisBase.swift @@ -12,6 +12,14 @@ import Foundation import CoreGraphics +#if canImport(UIKit) +import UIKit +#endif + +#if canImport(AppKit) +import AppKit +#endif + /// Base class for all axes @objc(ChartAxisBase) open class AxisBase: ComponentBase diff --git a/Source/Charts/Components/ChartLimitLine.swift b/Source/Charts/Components/ChartLimitLine.swift index fc876b4d80..2dc35dbe55 100644 --- a/Source/Charts/Components/ChartLimitLine.swift +++ b/Source/Charts/Components/ChartLimitLine.swift @@ -12,6 +12,13 @@ import Foundation import CoreGraphics +#if canImport(UIKit) +import UIKit +#endif + +#if canImport(AppKit) +import AppKit +#endif /// The limit line is an additional feature for all Line, Bar and ScatterCharts. /// It allows the displaying of an additional line in the chart that marks a certain maximum / limit on the specified axis (x- or y-axis). diff --git a/Source/Charts/Components/Legend.swift b/Source/Charts/Components/Legend.swift index e86d59ca53..a9cd40a489 100644 --- a/Source/Charts/Components/Legend.swift +++ b/Source/Charts/Components/Legend.swift @@ -12,6 +12,14 @@ import Foundation import CoreGraphics +#if canImport(UIKit) +import UIKit +#endif + +#if canImport(AppKit) +import AppKit +#endif + @objc(ChartLegend) open class Legend: ComponentBase { diff --git a/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift b/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift index aae7ae30ae..999e94e443 100644 --- a/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift +++ b/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift @@ -12,6 +12,13 @@ import Foundation import CoreGraphics +#if canImport(UIKit) +import UIKit +#endif + +#if canImport(AppKit) +import AppKit +#endif open class BarChartDataSet: BarLineScatterCandleBubbleChartDataSet, BarChartDataSetProtocol {