AnyChart-iOS
AnyChart-iOS copied to clipboard
Doesn't support multiple `AnyChartView` instances
Precondition
- I'm trying to display 2 charts on the same screen. First one on left half of the screen and second one on the right half.
- But I see that only one of them is displayed on the screen
Problem
- I looked at the
init
method insideAnyChartView.swift
and I seeAPIlib.sharedInstance.jsDelegate = self
there
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initSubviews()
}
override init(frame: CGRect) {
super.init(frame: frame)
initSubviews()
}
func initSubviews() {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: "AnyChartView", bundle: bundle)
nib.instantiate(withOwner: self, options: nil)
container.frame = bounds
addSubview(container)
let webConfiguration = WKWebViewConfiguration()
let customFrame = CGRect.init(origin: CGPoint.zero, size: CGSize.init(width: 0.0, height: container.frame.size.height))
webView = WKWebView (frame: customFrame , configuration: webConfiguration)
webView.translatesAutoresizingMaskIntoConstraints = false
container.addSubview(webView)
webView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true
webView.rightAnchor.constraint(equalTo: container.rightAnchor).isActive = true
webView.leftAnchor.constraint(equalTo: container.leftAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: container.bottomAnchor).isActive = true
webView.heightAnchor.constraint(equalTo: container.heightAnchor).isActive = true
APIlib.sharedInstance.jsDelegate = self
}
So it is impossible to use more than one AnyChartView
object instance simultaneously.
Is it possible to make a workaround for that?
@AntonPoltoratskyi Unfortunately, the current version of the library doesn't support multiple Views. We have been asked about that frequently, so we will take into account for future updates.
Thanks for your reply!