Open st34m3dr1c3 opened 6 years ago
I'd also like to add that making the chart the CardPart (instead of creating a general UIView CardPart and embedding the chart inside) also creates the same problem. Works fine on the default Mint theme in which the left and right insets are nonzero, but will freeze on the Turbo theme where the left and right insets are zero.
class ChartCardPartView : CombinedChartView, CardPartView {
public var margins: UIEdgeInsets = CardParts.theme.cardPartMargins
public init() {
super.init(frame: CGRect.zero)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
See the resulting chart implementation in the CardsViewController:
class MainViewController: CardsViewController {
...
let chart = ChartCardPartView()
...
func setupChartView() {
chart.addConstraint(NSLayoutConstraint(item: chart, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: 300))
chart.addConstraint(NSLayoutConstraint(item: chart, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: 300))
}
override func viewDidLoad() {
...
super.viewDidLoad()
...
setupChartView()
}
...
}
First off, I want to say that this library is fantastic!
On to the problem: I am using a stack of custom cards, one of which simply has a chart view embedded inside (taken from the iOS Charts library). However, using this card will cause the app to freeze unless I set the left and right margins to nonzero in the CardsViewController, e.g. with the following application:
However, doing so means that the cards cannot hug the edge of the screen. As mentioned previously, setting the insets to default (0 for left and right) causes the app to freeze.
See snippet for my custom card below, which has a chart embedded inside:
Is it possible to use this card without having to use nonzero left and right insets? Any help or insight would be greatly appreciated. Thanks!