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

The table view cell is not editable from outside the framework. #804

Open
2 of 4 tasks
bhavesh-huma opened this issue Sep 20, 2024 · 0 comments
Open
2 of 4 tasks

Comments

@bhavesh-huma
Copy link

bhavesh-huma commented Sep 20, 2024

Allow access to the country function to update the table view cell from outside the framework.

Make this function public so it can be access in the implementation class.

public func country(for indexPath: IndexPath) -> Country {
      isFiltering ? filteredCountries[indexPath.row] : countries[indexPath.section][indexPath.row]
}

By overriding the following method, can update the own cell.

public override func sectionIndexTitles(for tableView: UITableView) -> [String] { [] }

public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
    let country = self.country(for: indexPath)

    cell.textLabel?.text = country.flag + " " + country.name
    cell.detailTextLabel?.text = country.prefix
    
    return cell
}

New Issue Checklist

Steps to reproduce

Expected result
Actual result

Environment

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

1 participant