-
Notifications
You must be signed in to change notification settings - Fork 499
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
is there possible to make collapsed menu #370
Comments
Yes, it is possible. public struct ExpandableListVM<T, H> {
/// Model for cell with expand button
public let headerItem: H
/// raw items
public let _items: [T]
/// items are shown only when isExpanded == true
public var items: [T] {
isExpanded ? _items : []
}
public let isExpanded: Bool
public init(headerItem: H, items: [T], isExpanded: Bool) {
self.headerItem = headerItem
_items = items
self.isExpanded = isExpanded
}
// when expand button is tapped, get new model with this method
public func togglingExpand() -> Self {
copy(isExpanded: !isExpanded)
}
public func copy(isExpanded: Bool) -> Self {
.init(headerItem: headerItem, items: _items, isExpanded: isExpanded)
}
} |
@iDmitriyy can you please showed how use this struct in real example ? |
Maybe you can use RxRelay as the Observable, when sectionTitle is tapped,change the value of RxRelay object. |
this is a demo I write: |
Hello!
I have 3 sections and when user tap it should open and show it child datas when user again tap it should close current table views cell. I mean, I'm trying to make collapsed table view. is there possible to make it. Like this

The text was updated successfully, but these errors were encountered: