Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.53k stars 1.1k forks source link

UITableViewCell as datasource. For cell that was defined on runtime #387

Closed michaelhenry closed 3 years ago

michaelhenry commented 3 years ago

Summary

I don't know if this is still helpful, especially nowadays, but sometimes we have a cell that was defined on runtime and did not use the UITableView.register() process.

example:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cellId = "cellId"

        var cell = tableView.dequeueReusableCell(withIdentifier: cellId)
        if cell == nil {
            cell = UITableViewCell(style: .default, reuseIdentifier: cellId)

            // Do some creation setup
        }

        // assign some values

        return cell!
}

This PR will add an option to specify a UITableViewCell, aside from using a ReusableCellIdentifier.

func collectionSkeletonView(_ skeletonView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell?

Requirements (place an x in each of the [ ])

Juanpe commented 3 years ago

Hi @michaelhenry

Thanks for the contribution, but TBH I don't know if this code gives value to the library 🤔 I mean, there is no problem related to this, so maybe this code makes the codebase more complex instead of providing value.

WDYT?

michaelhenry commented 3 years ago

@Juanpe no worries. I agree with you too. Thanks for checking. I'm closing this ticket now. thanks

Juanpe commented 3 years ago

Hi @michaelhenry, In the end, I've decided to add this feature to the library. So, if you don't matter I'm going to use your code and I'll add some improvements.

BTW, @broadwaylamb, this is something that you proposed as well, didn't you?

Juanpe commented 3 years ago

This feature was included in the PR #414