Skip to content

Commit

Permalink
danielgindi/Charts PR ChartsOrg#4017
Browse files Browse the repository at this point in the history
Fix Swift Package Manager compile issue ChartsOrg#4017
  • Loading branch information
andersonjulian committed Aug 2, 2019
1 parent 8c28cfa commit 0535aa2
Show file tree
Hide file tree
Showing 27 changed files with 126 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import Foundation
import Charts

import UIKit

open class BalloonMarker: MarkerImage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import Charts
import UIKit

open class RadarMarkerView: MarkerView
{
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo-iOS/Objective-C/Components/XYMarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import Foundation
import Charts
import UIKit

open class XYMarkerView: BalloonMarker
{
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo-iOS/Swift/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import Charts
import UIKit

open class BalloonMarker: MarkerImage
{
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo-iOS/Swift/Components/RadarMarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import Charts
import UIKit

public class RadarMarkerView: MarkerView {
@IBOutlet var label: UILabel!
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo-iOS/Swift/Components/XYMarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Foundation
import Charts
import UIKit

public class XYMarkerView: BalloonMarker {
public var xAxisValueFormatter: IAxisValueFormatter
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import Charts
import UIKit

class BarChartViewController: DemoBaseViewController {

Expand Down
11 changes: 6 additions & 5 deletions ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import Charts
import UIKit

private let ITEM_COUNT = 12

Expand Down Expand Up @@ -40,11 +41,11 @@ class CombinedChartViewController: DemoBaseViewController {
chartView.highlightFullBarEnabled = false


chartView.drawOrder = [DrawOrder.bar.rawValue,
DrawOrder.bubble.rawValue,
DrawOrder.candle.rawValue,
DrawOrder.line.rawValue,
DrawOrder.scatter.rawValue]
chartView.drawOrder = [CombinedChartView.DrawOrder.bar.rawValue,
CombinedChartView.DrawOrder.bubble.rawValue,
CombinedChartView.DrawOrder.candle.rawValue,
CombinedChartView.DrawOrder.line.rawValue,
CombinedChartView.DrawOrder.scatter.rawValue]

let l = chartView.legend
l.wordWrapEnabled = true
Expand Down
1 change: 1 addition & 0 deletions Source/Charts/Animation/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import CoreGraphics
import QuartzCore

@objc(ChartAnimatorDelegate)
public protocol AnimatorDelegate
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

/// Base-class of LineChart, BarChart, ScatterChart and CandleStickChart.
open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartDataProvider, NSUIGestureRecognizerDelegate
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

@objc
public protocol ChartViewDelegate
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Charts/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

/// View that represents a pie chart. Draws cake like slices.
open class PieChartView: PieRadarChartViewBase
{
Expand Down
1 change: 1 addition & 0 deletions Source/Charts/Charts/PieRadarChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import CoreGraphics
import QuartzCore

/// Base class of PieChartView and RadarChartView.
open class PieRadarChartViewBase: ChartViewBase
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Components/Description.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

@objc(ChartDescription)
open class Description: ComponentBase
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Components/YAxis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif


/// Class representing the y-axis labels settings and its entries.
/// Be aware that not all features the YLabels class provides are suitable for the RadarChart.
Expand Down
1 change: 1 addition & 0 deletions Source/Charts/Filters/DataApproximator+N.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

import Foundation
import CoreGraphics

extension CGPoint {
fileprivate func distanceToLine(from linePoint1: CGPoint, to linePoint2: CGPoint) -> CGFloat {
Expand Down
1 change: 1 addition & 0 deletions Source/Charts/Jobs/AnimatedViewPortJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import Foundation
import CoreGraphics
import QuartzCore

open class AnimatedViewPortJob: ViewPortJob
{
Expand Down
15 changes: 10 additions & 5 deletions Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
{
/// A nested array of elements ordered logically (i.e not in visual/drawing order) for use with VoiceOver
Expand Down Expand Up @@ -867,12 +875,9 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
} else {
stackLabel = nil
}

//Handles empty array of yValues
let yValue = vals.isEmpty ? 0.0 : vals[idx % vals.count]


elementValueText = dataSet.valueFormatter?.stringForValue(
yValue,
vals[idx % stackSize],
entry: e,
dataSetIndex: dataSetIndex,
viewPortHandler: viewPortHandler) ?? "\(e.y)"
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Renderers/ChartDataRendererBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

@objc(ChartDataRendererBase)
open class DataRenderer: Renderer
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Renderers/HorizontalBarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

open class HorizontalBarChartRenderer: BarChartRenderer
{
private class Buffer
Expand Down
12 changes: 9 additions & 3 deletions Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

open class PieChartRenderer: DataRenderer
{
@objc open weak var chart: PieChartView?
Expand Down Expand Up @@ -880,9 +888,7 @@ open class PieChartRenderer: DataRenderer

// Prepend selected slices before the already rendered unselected ones.
// NOTE: - This relies on drawDataSet() being called before drawHighlighted in PieChartView.
if !accessibleChartElements.isEmpty {
accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)
}
accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1)

context.restoreGState()
}
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Renderers/XAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

@objc(ChartXAxisRenderer)
open class XAxisRenderer: AxisRendererBase
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Renderers/YAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

@objc(ChartYAxisRenderer)
open class YAxisRenderer: AxisRendererBase
{
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Renderers/YAxisRendererRadarChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

open class YAxisRendererRadarChart: YAxisRenderer
{
private weak var chart: RadarChartView?
Expand Down
8 changes: 8 additions & 0 deletions Source/Charts/Utils/ChartUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation
import CoreGraphics

#if canImport(UIKit)
import UIKit
#endif

#if canImport(Cocoa)
import Cocoa
#endif

extension Comparable {
func clamped(to range: ClosedRange<Self>) -> Self {
if self > range.upperBound {
Expand Down
1 change: 1 addition & 0 deletions Source/Charts/Utils/Platform+Accessibility.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

#if os(iOS) || os(tvOS)
import UIKit

internal func accessibilityPostLayoutChangedNotification(withElement element: Any? = nil)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 0535aa2

Please sign in to comment.