An amazing project that generates micro reports from tournament results
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pa-tournament-stats/TournamentStats/UI/reports/InfographyView.swift

53 lines
1.8 KiB

//
// InfographyView.swift
// TournamentStats
//
// Created by Laurent Morvillier on 05/08/2019.
// Copyright © 2019 Stax River. All rights reserved.
//
import Foundation
import UIKit
class InfographyView : UIView {
var references: [UITableViewDataSource] = []
init(frame: CGRect, generator: ReportGenerator) {
super.init(frame: frame)
self.backgroundColor = UIColor.white
let table1 = UITableView(frame: CGRect(x: 0, y: 0, width: 500, height: 500), style: .grouped)
table1.register(UINib(nibName: "StackTableCell", bundle: Bundle.main), forCellReuseIdentifier: "Cell")
table1.backgroundColor = UIColor.clear
let ds = DataSourceWrapper(array: generator.biggestWinners)
table1.dataSource = ds
table1.delegate = ds
self.references.append(ds)
let table2 = UITableView(frame: CGRect(x: 500, y: 0, width: 500, height: 500), style: .grouped)
table2.register(UINib(nibName: "StackTableCell", bundle: Bundle.main), forCellReuseIdentifier: "Cell")
table2.backgroundColor = UIColor.clear
let ds2 = DataSourceWrapper(array: generator.winsByCountry)
table2.dataSource = ds2
table2.delegate = ds2
self.references.append(ds2)
let hstack1: UIStackView = UIStackView(arrangedSubviews: [table1, table2])
hstack1.distribution = .fill
hstack1.backgroundColor = UIColor.green
hstack1.axis = .horizontal
let vstack: UIStackView = UIStackView(arrangedSubviews: [hstack1])
hstack1.backgroundColor = UIColor.blue
vstack.axis = .vertical
self.addSubview(vstack)
self.addMaxConstraints(view: vstack)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}