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

[Question] Access to the cell #73

Open
wow-such-amazing opened this issue Nov 18, 2019 · 2 comments
Open

[Question] Access to the cell #73

wow-such-amazing opened this issue Nov 18, 2019 · 2 comments

Comments

@wow-such-amazing
Copy link

wow-such-amazing commented Nov 18, 2019

I would like to have access to the cell that contains a row.
I wanted to create an extension similar to this one, but stackView is private.

extension AloeStackView {
    func cell(with row: UIView) -> StackViewCell? {
        return stackView.arrangedSubviews.first(where: { arrangedSubview in
            guard let cell = arrangedSubview as? StackViewCell, cell.contentView == row else { return false }
            return true
        }) as? StackViewCell
    }
}

I want this access because I want to change second cell's topLeft and topRight corner radius.

Is there a way to do what I mentioned without making stackView public? If no, would it be possible to make it public?

Thank you!

@yanamura
Copy link
Contributor

@crabman448 How about use func cellForRow(_ row: UIView) -> StackViewCell ?
https://github.com/airbnb/AloeStackView/blob/master/Sources/AloeStackView/AloeStackView.swift#L458

@wow-such-amazing
Copy link
Author

@yanamura As I understand this function doesn't return the currently displayed cell for the specified row, but it creates a new cell and returns it.

I actually came up with another solution to use in my case, so you may close the issue. Thank you for reaching me out!

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