Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table header not displayed #95

Closed
eimantas opened this issue Jan 20, 2019 · 1 comment
Closed

Table header not displayed #95

eimantas opened this issue Jan 20, 2019 · 1 comment

Comments

@eimantas
Copy link

I'm testing out this library and based on documentation I can't seem to display table's header (an empty one).

Release: 0.3
Package Manager: Carthage

Here's my view controller:

class ViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let box = Box<Int, Int>.empty
            |-+ Section<Int, Int>(id: 0,
                                  header: EmptySpaceComponent(height: 24, color: .green),
                                  footer: EmptySpaceComponent(height: 50, color: .red))
            |---+ 5 <> RowComponent(i: 5)

        tableView.render(box)
    }
}

The EmptySpaceComponent:

struct EmptySpaceComponent: Renderable {

    var height: CGFloat
    var color: UIColor

    typealias View = UIView

    func render(in view: UIView) {
        view.heightAnchor.constraint(equalToConstant: height).isActive = true
        view.backgroundColor = color
        view.layoutIfNeeded()
    }
}

And the RowComponent:

struct RowComponent: Renderable {

    var i: Int

    typealias View = UILabel

    func render(in view: UILabel) {
        view.text = "\(i)"
        view.heightAnchor.constraint(equalToConstant: 50).isActive = true
    }
}
@andersio
Copy link
Contributor

andersio commented May 4, 2019

We haven't been making regular releases after 0.3 (until recently) which would otherwise carry the fix. My apologies.

@andersio andersio closed this as completed May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants