FlowKit icon indicating copy to clipboard operation
FlowKit copied to clipboard

Section uniqness

Open wow-such-amazing opened this issue 6 years ago • 3 comments

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 avatar Oct 18 '18 12:10 wow-such-amazing

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
    }
}

wow-such-amazing avatar Nov 21 '18 10:11 wow-such-amazing

@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.

shamiulrain avatar Dec 18 '18 05:12 shamiulrain

@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.

wow-such-amazing avatar Dec 18 '18 16:12 wow-such-amazing