From 370a5cb3ca468881f6c29d6d80221248b437dbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B8=CC=86=20=D0=91?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D1=83=D1=81=D0=BE=D0=B2?= Date: Sat, 7 Aug 2021 01:31:01 +0300 Subject: [PATCH 1/3] Replace protocol inheritance from class with AnyObject --- LightweightCharts/Classes/Implementations/API/Chart.swift | 2 +- .../Classes/Implementations/API/LightweightCharts.swift | 2 +- .../Classes/Implementations/JavaScriptEvaluator.swift | 2 +- .../Classes/Implementations/JavaScriptObject.swift | 2 +- .../Classes/Implementations/Subscription/MessageHandler.swift | 2 +- .../Implementations/SyncScriptEvaluating/PromptHandler.swift | 2 +- LightweightCharts/Classes/Implementations/WebView.swift | 2 +- LightweightCharts/Classes/Protocols/ChartApi.swift | 2 +- LightweightCharts/Classes/Protocols/PriceFormatterApi.swift | 2 +- LightweightCharts/Classes/Protocols/PriceLineApi.swift | 2 +- LightweightCharts/Classes/Protocols/PriceScaleApi.swift | 2 +- LightweightCharts/Classes/Protocols/SeriesApi.swift | 2 +- LightweightCharts/Classes/Protocols/TimeScaleApi.swift | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/LightweightCharts/Classes/Implementations/API/Chart.swift b/LightweightCharts/Classes/Implementations/API/Chart.swift index c4d30dd..036fc41 100644 --- a/LightweightCharts/Classes/Implementations/API/Chart.swift +++ b/LightweightCharts/Classes/Implementations/API/Chart.swift @@ -1,7 +1,7 @@ import Foundation import WebKit -public protocol ChartDelegate: class { +public protocol ChartDelegate: AnyObject { func didClick(onChart chart: ChartApi, parameters: MouseEventParams) func didCrosshairMove(onChart chart: ChartApi, parameters: MouseEventParams) diff --git a/LightweightCharts/Classes/Implementations/API/LightweightCharts.swift b/LightweightCharts/Classes/Implementations/API/LightweightCharts.swift index 6fa132d..c213c1a 100644 --- a/LightweightCharts/Classes/Implementations/API/LightweightCharts.swift +++ b/LightweightCharts/Classes/Implementations/API/LightweightCharts.swift @@ -1,7 +1,7 @@ import Foundation import WebKit -public protocol LightweightChartsDelegate: class { +public protocol LightweightChartsDelegate: AnyObject { func lightweightChartsDidLoad(_ lightweightCharts: LightweightCharts) func lightweightCharts(_ lightweightCharts: LightweightCharts, didFailLoadWithError error: Error) diff --git a/LightweightCharts/Classes/Implementations/JavaScriptEvaluator.swift b/LightweightCharts/Classes/Implementations/JavaScriptEvaluator.swift index 62b3f41..0d0f7e0 100644 --- a/LightweightCharts/Classes/Implementations/JavaScriptEvaluator.swift +++ b/LightweightCharts/Classes/Implementations/JavaScriptEvaluator.swift @@ -1,7 +1,7 @@ import Foundation import WebKit -protocol JavaScriptEvaluator: class { +protocol JavaScriptEvaluator: AnyObject { func evaluateScript(_ script: String, completion: ((Any?, Error?) -> Void)?) func decodedResult(forScript script: String, completion: @escaping (T?) -> Void) diff --git a/LightweightCharts/Classes/Implementations/JavaScriptObject.swift b/LightweightCharts/Classes/Implementations/JavaScriptObject.swift index 796466d..65fa1bf 100644 --- a/LightweightCharts/Classes/Implementations/JavaScriptObject.swift +++ b/LightweightCharts/Classes/Implementations/JavaScriptObject.swift @@ -1,4 +1,4 @@ -protocol JavaScriptObject: class { +protocol JavaScriptObject: AnyObject { var jsName: String { get } diff --git a/LightweightCharts/Classes/Implementations/Subscription/MessageHandler.swift b/LightweightCharts/Classes/Implementations/Subscription/MessageHandler.swift index acc8685..fe0ecee 100644 --- a/LightweightCharts/Classes/Implementations/Subscription/MessageHandler.swift +++ b/LightweightCharts/Classes/Implementations/Subscription/MessageHandler.swift @@ -1,7 +1,7 @@ import Foundation import WebKit -protocol MessageHandlerDelegate: class { +protocol MessageHandlerDelegate: AnyObject { func messageHandler(_ messageHandler: MessageHandler, didReceiveClickWithParameters parameters: MouseEventParams) diff --git a/LightweightCharts/Classes/Implementations/SyncScriptEvaluating/PromptHandler.swift b/LightweightCharts/Classes/Implementations/SyncScriptEvaluating/PromptHandler.swift index 1725e0e..370079f 100644 --- a/LightweightCharts/Classes/Implementations/SyncScriptEvaluating/PromptHandler.swift +++ b/LightweightCharts/Classes/Implementations/SyncScriptEvaluating/PromptHandler.swift @@ -1,7 +1,7 @@ import Foundation import WebKit -protocol ClosuresStore: class { +protocol ClosuresStore: AnyObject { func addMethod(_ method: JavaScriptMethod, forName name: String) diff --git a/LightweightCharts/Classes/Implementations/WebView.swift b/LightweightCharts/Classes/Implementations/WebView.swift index 4aad7c0..fb4098a 100644 --- a/LightweightCharts/Classes/Implementations/WebView.swift +++ b/LightweightCharts/Classes/Implementations/WebView.swift @@ -1,6 +1,6 @@ import WebKit -public protocol JavaScriptErrorDelegate: class { +public protocol JavaScriptErrorDelegate: AnyObject { func didFailEvaluateScript(_ script: String, withError error: Error) diff --git a/LightweightCharts/Classes/Protocols/ChartApi.swift b/LightweightCharts/Classes/Protocols/ChartApi.swift index 6806ebe..98ccd6f 100644 --- a/LightweightCharts/Classes/Protocols/ChartApi.swift +++ b/LightweightCharts/Classes/Protocols/ChartApi.swift @@ -3,7 +3,7 @@ import UIKit /** The main interface of a single chart */ -public protocol ChartApi: class { +public protocol ChartApi: AnyObject { /** * Subsription delegate for chart events. Weak reference. diff --git a/LightweightCharts/Classes/Protocols/PriceFormatterApi.swift b/LightweightCharts/Classes/Protocols/PriceFormatterApi.swift index 4c103fe..73100ff 100644 --- a/LightweightCharts/Classes/Protocols/PriceFormatterApi.swift +++ b/LightweightCharts/Classes/Protocols/PriceFormatterApi.swift @@ -1,7 +1,7 @@ import Foundation /** Interface to be implemented by the object in order to be used as a price formatter */ -public protocol PriceFormatterApi: class { +public protocol PriceFormatterApi: AnyObject { /** * Formatting function diff --git a/LightweightCharts/Classes/Protocols/PriceLineApi.swift b/LightweightCharts/Classes/Protocols/PriceLineApi.swift index 5de453c..5067c19 100644 --- a/LightweightCharts/Classes/Protocols/PriceLineApi.swift +++ b/LightweightCharts/Classes/Protocols/PriceLineApi.swift @@ -1,6 +1,6 @@ import Foundation -public protocol PriceLineApi: class { +public protocol PriceLineApi: AnyObject { func applyOptions(options: PriceLineOptions) func options(completion: @escaping (PriceLineOptions?) -> Void) diff --git a/LightweightCharts/Classes/Protocols/PriceScaleApi.swift b/LightweightCharts/Classes/Protocols/PriceScaleApi.swift index 5f6ad5e..a792e3a 100644 --- a/LightweightCharts/Classes/Protocols/PriceScaleApi.swift +++ b/LightweightCharts/Classes/Protocols/PriceScaleApi.swift @@ -1,7 +1,7 @@ import Foundation /** Interface to control chart's price scale */ -public protocol PriceScaleApi: class { +public protocol PriceScaleApi: AnyObject { /** * Applies new options to the price scale diff --git a/LightweightCharts/Classes/Protocols/SeriesApi.swift b/LightweightCharts/Classes/Protocols/SeriesApi.swift index 385ec78..1c9d421 100644 --- a/LightweightCharts/Classes/Protocols/SeriesApi.swift +++ b/LightweightCharts/Classes/Protocols/SeriesApi.swift @@ -1,6 +1,6 @@ import Foundation -public protocol SeriesApi: class { +public protocol SeriesApi: AnyObject { associatedtype Options: SeriesOptionsCommon associatedtype TickValue: SeriesData diff --git a/LightweightCharts/Classes/Protocols/TimeScaleApi.swift b/LightweightCharts/Classes/Protocols/TimeScaleApi.swift index 2e4dd97..d738d3f 100644 --- a/LightweightCharts/Classes/Protocols/TimeScaleApi.swift +++ b/LightweightCharts/Classes/Protocols/TimeScaleApi.swift @@ -1,7 +1,7 @@ import CoreGraphics /** Interface to chart time scale */ -public protocol TimeScaleApi: class { +public protocol TimeScaleApi: AnyObject { var delegate: TimeScaleDelegate? { get set } From 33fed06b407a3c6ac784fbdf026247d3b0489156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B8=CC=86=20=D0=91?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D1=83=D1=81=D0=BE=D0=B2?= Date: Sat, 7 Aug 2021 02:25:50 +0300 Subject: [PATCH 2/3] Add fixRightEdge and minBarSpacing options to TimeScaleOptions --- .../Options/Basics/TimeScaleOptions.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LightweightCharts/Classes/LightweightChartsModels/Options/Basics/TimeScaleOptions.swift b/LightweightCharts/Classes/LightweightChartsModels/Options/Basics/TimeScaleOptions.swift index 9c82289..83d1c89 100644 --- a/LightweightCharts/Classes/LightweightChartsModels/Options/Basics/TimeScaleOptions.swift +++ b/LightweightCharts/Classes/LightweightChartsModels/Options/Basics/TimeScaleOptions.swift @@ -4,7 +4,9 @@ public struct TimeScaleOptions { public var rightOffset: Double? public var barSpacing: Double? + public var minBarSpacing: Double? public var fixLeftEdge: Bool? + public var fixRightEdge: Bool? public var lockVisibleTimeRangeOnResize: Bool? public var rightBarStaysOnScroll: Bool? public var borderVisible: Bool? @@ -26,7 +28,9 @@ public struct TimeScaleOptions { public init(rightOffset: Double? = nil, barSpacing: Double? = nil, + minBarSpacing: Double? = nil, fixLeftEdge: Bool? = nil, + fixRightEdge: Bool? = nil, lockVisibleTimeRangeOnResize: Bool? = nil, rightBarStaysOnScroll: Bool? = nil, borderVisible: Bool? = nil, @@ -38,7 +42,9 @@ public struct TimeScaleOptions { tickMarkFormatter: JavaScriptMethod? = nil) { self.rightOffset = rightOffset self.barSpacing = barSpacing + self.minBarSpacing = minBarSpacing self.fixLeftEdge = fixLeftEdge + self.fixRightEdge = fixLeftEdge self.lockVisibleTimeRangeOnResize = lockVisibleTimeRangeOnResize self.rightBarStaysOnScroll = rightBarStaysOnScroll self.borderVisible = borderVisible From 15b230946ea502eeaa0bb291f519bd6177580ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B8=CC=86=20=D0=91?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D1=83=D1=81=D0=BE=D0=B2?= Date: Sat, 7 Aug 2021 02:30:37 +0300 Subject: [PATCH 3/3] Migrate to v3.5.0 --- Example/LightweightCharts.xcodeproj/project.pbxproj | 4 ++-- Example/Podfile.lock | 6 +++--- LightweightCharts.podspec | 6 +++--- README.md | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Example/LightweightCharts.xcodeproj/project.pbxproj b/Example/LightweightCharts.xcodeproj/project.pbxproj index d561777..8d9af53 100644 --- a/Example/LightweightCharts.xcodeproj/project.pbxproj +++ b/Example/LightweightCharts.xcodeproj/project.pbxproj @@ -620,7 +620,7 @@ INFOPLIST_FILE = LightweightCharts/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.3.0; + MARKETING_VERSION = 3.5.0; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "tradingview.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -638,7 +638,7 @@ INFOPLIST_FILE = LightweightCharts/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.3.0; + MARKETING_VERSION = 3.5.0; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "tradingview.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 67c2057..4b281ef 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - LightweightCharts (3.3.0) + - LightweightCharts (3.5.0) DEPENDENCIES: - LightweightCharts (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - LightweightCharts: 05a4b19200513eb5a063ff81b09b8e18aee3997e + LightweightCharts: 9a374056b466a14aba9513907af6c6763a209cc3 PODFILE CHECKSUM: 10aa45b030d82b96cfc0e4e3b143c5488576107b -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.1 diff --git a/LightweightCharts.podspec b/LightweightCharts.podspec index 49b5952..53bf014 100644 --- a/LightweightCharts.podspec +++ b/LightweightCharts.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'LightweightCharts' - s.version = '3.3.0' + s.version = '3.5.0' s.summary = 'LightweightCharts for iOS.' s.description = 'LightweightCharts pod. Swift wrapper above JavaScript library.' s.homepage = 'https://tradingview.com' @@ -19,9 +19,9 @@ Pod::Spec.new do |s| :script => 'LIBRARY=${TEMP_DIR}/lightweight-charts.js if [ "${CONFIGURATION}" = "Release" ]; then - curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.3.0/dist/lightweight-charts.standalone.production.js + curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.5.0/dist/lightweight-charts.standalone.production.js else - curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.3.0/dist/lightweight-charts.standalone.development.js + curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.5.0/dist/lightweight-charts.standalone.development.js fi cp -f $LIBRARY ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/lightweight-charts.js' diff --git a/README.md b/README.md index edf27ea..f3ae1e0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ LightweightCharts is available through [CocoaPods](https://cocoapods.org). To in it, just simply add the following line to your Podfile: ```ruby -pod 'LightweightCharts', '~> 3.3.0' +pod 'LightweightCharts', '~> 3.5.0' ``` ## Usage