From d59fb0fde35353bea568f63b4602d1d8f3f7320c Mon Sep 17 00:00:00 2001 From: mlisivick Date: Fri, 29 Sep 2017 19:08:34 -0300 Subject: [PATCH] Add optional currency settings --- Classes/Drawing/ReferenceLineDrawingView.swift | 5 ++++- Classes/Reference/ReferenceLines.swift | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/Drawing/ReferenceLineDrawingView.swift b/Classes/Drawing/ReferenceLineDrawingView.swift index 965f399..bb2af07 100644 --- a/Classes/Drawing/ReferenceLineDrawingView.swift +++ b/Classes/Drawing/ReferenceLineDrawingView.swift @@ -106,7 +106,10 @@ internal class ReferenceLineDrawingView : UIView { numberFormatter.numberStyle = self.settings.referenceLineNumberStyle numberFormatter.minimumFractionDigits = self.settings.referenceLineNumberOfDecimalPlaces numberFormatter.maximumFractionDigits = self.settings.referenceLineNumberOfDecimalPlaces - + if let currencyCode = self.settings.currencyCode, let currencySymbol = self.settings.currencySymbol{ + numberFormatter.currencyCode = currencyCode + numberFormatter.currencySymbol = currencySymbol + } return numberFormatter } diff --git a/Classes/Reference/ReferenceLines.swift b/Classes/Reference/ReferenceLines.swift index 38f12aa..6847b37 100644 --- a/Classes/Reference/ReferenceLines.swift +++ b/Classes/Reference/ReferenceLines.swift @@ -51,7 +51,10 @@ open class ReferenceLines { @IBInspectable open var referenceLineNumberOfDecimalPlaces: Int = 0 /// The NSNumberFormatterStyle that reference lines should use to display @IBInspectable open var referenceLineNumberStyle: NumberFormatter.Style = .none - + /// The default currency of the referenceLineNumberStyle + @IBInspectable open var currencyCode: String? + /// The default currency symbol of the referenceLineNumberStyle + @IBInspectable open var currencySymbol: String? // Data Point Labels // TODO: Refactor these into their own settings and allow for more label options (positioning) // ################################################################################################################