Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Section uniqness #22

Open
wow-such-amazing opened this issue Oct 18, 2018 · 3 comments
Open

Section uniqness #22

wow-such-amazing opened this issue Oct 18, 2018 · 3 comments

Comments

@wow-such-amazing
Copy link

wow-such-amazing commented Oct 18, 2018

I have another thing to discuss. As I understand TableSection uniqueness is based on the

/// Unique identifier of the section
public let UUID: String = NSUUID().uuidString

Do you think it is the best approach? Maybe it is better to somehow calculate it based on section content? Or probably externalise it out of the library to the users of the library?
Because I think current implementation affect situations, when we have the same section, but with slightly different content. And in this case I want to apply changes across elements inside section, but not reload the whole section

@wow-such-amazing
Copy link
Author

For now I store sections in the ViewController to prevent reloading them, when only content changes.
Example:

struct MySections {
    var myFirstSection = TableSection(nil)
    var mySecondSection = TableSection(nil)
    var myThirdSection = TableSection(nil)

    var sectionsToDisplay: [TableSection] {
        var sections: [TableSection] = []
        if !myFirstSection.models.isEmpty { sections.append(myFirstSection) }
        if !mySecondSection.models.isEmpty { sections.append(mySecondSection) }
        if !myThirdSection.models.isEmpty { sections.append(myThirdSection) }
        return sections
    }
}

@shamiulrain
Copy link

@crabman448 can u please give me your code because i faced some problem with reload , when i change label text in cell , table reload did not update cell.

@wow-such-amazing
Copy link
Author

@shamiulrain there are a lot of possibilities why your code doesn't work. And usually it is better when you provide your code with pointing out what you did, what do you expect, ideas you tried to make it work and etc.

And I suppose that your problem is not related to the topic of this issue. Take a look at example project that is available in this repo. Maybe this will give you some ideas where do you have a problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants