{"id":834,"url":"https://github.com/Kilograpp/UITableView-Cache","last_synced_at":"2025-07-30T19:32:21.128Z","repository":{"id":56925060,"uuid":"61471575","full_name":"Kilograpp/UITableView-Cache","owner":"Kilograpp","description":"UITableView cell cache that cures scroll-lags on cell instantiating","archived":false,"fork":false,"pushed_at":"2017-02-13T12:28:19.000Z","size":29,"stargazers_count":72,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-02T09:05:26.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kilograpp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-19T08:44:05.000Z","updated_at":"2024-05-17T19:09:40.000Z","dependencies_parsed_at":"2022-08-20T22:50:24.745Z","dependency_job_id":null,"html_url":"https://github.com/Kilograpp/UITableView-Cache","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kilograpp%2FUITableView-Cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kilograpp%2FUITableView-Cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kilograpp%2FUITableView-Cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kilograpp%2FUITableView-Cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kilograpp","download_url":"https://codeload.github.com/Kilograpp/UITableView-Cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228178890,"owners_count":17881105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:32.487Z","updated_at":"2024-12-04T19:31:59.126Z","avatar_url":"https://github.com/Kilograpp.png","language":"Objective-C","funding_links":[],"categories":["Cache","HarmonyOS"],"sub_categories":["Other free courses","Getting Started","Windows Manager"],"readme":"[![Build Status](https://travis-ci.org/Kilograpp/UITableView-Cache.svg?branch=master)](https://travis-ci.org/Kilograpp/UITableView-Cache)\n[![Pod Version](https://img.shields.io/cocoapods/v/UITableView+Cache.svg?style=flat)](http://cocoadocs.org/docsets/UITableView+Cache/)\n[![codebeat badge](https://codebeat.co/badges/1c7930d9-7431-49ff-989c-f906779f00bc?t=)](https://codebeat.co/projects/github-com-kilograpp-uitableview-cache)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Kilograpp/UITableView-Cache)\n\n# UITableView + Cache\n[https://github.com/Kilograpp/UITableView-Cache](https://github.com/Kilograpp/UITableView-Cache)\n\nUITableView cell cache that cures scroll-lags on a cell instantiating. \n\n## Introduction\n\n`UITableView+Cache` is a light `UITableView` category that purges scroll-lag that occurs on a new cell instantiation during scroll. \nIt makes UITableView instantiate and cache cells before cellForRow:atIndexPath: call. It also provides simple interface very similar to existing registerClass/registerNib one. \n\n## Installation\n\n### CocoaPods\n\n``` batch\n\tpod 'UITableView+Cache'\n```\n\n### Carthage\n\n``` batch\n\tgithub \"Kilograpp/UITableView-Cache\" \"master\"\n```\n\n### Manual importing\n\nJust add all files from src directory to your project.\n\n\n## Usage\n\nWhen registering custom cells, call overriden registerClass/registerNib method instead of a default. `UITableView+Cache` swizzles dequeueReusableCellWithIdentifier methods with a private one that uses its own cache and implements registerClass/registerNib mechanism on itself. \nWhen dequeueReusableCellWithIdentifier is called and returns nil - the cache is asked for a cell. If cache is empty then cell is created using registered class or nib.\n\n#### Swift 3\n\n``` swift\nimport UITableView_Cache\n\n...\n\noverride func viewDidLoad() {\n\tsuper.viewDidLoad()\n\n\tself.tableView.registerClass(TableViewCodeCell.self, forCellReuseIdentifier: \"MyReuseIdentifier\", cacheSize: 10)\n\tself.tableView.registerNib(TableViewCodeCell.nib, forCellReuseIdentifier: \"MyReuseIdentifier\", cacheSize: 10)\n}\n\n...\n\noverride func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -\u003e UITableViewCell {\n\tlet cell = self.tableView.dequeueReusableCellWithIdentifier(\"MyReuseIdentifier\") as! TableViewCodeCell\n\treturn cell\n}\n```\n\n#### Objective-C\n\n``` objective-c\n- (void)viewDidLoad {\n\t[super viewDidLoad];\n\n\t[self.tableView registerClass:[TableViewCodeCell class] forCellReuseIdentifier:@\"MyReuseIdentifier\" cacheSize:10];\n\t[self.tableView registerNib:[TableViewNibCell nib] forCellReuseIdentifier:@\"MyNibReuseIdentifier\" cacheSize:10];\n}\n\n...\n\n- (MyCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n\tMyCell* cell = [tableView dequeueReusableCellWithIdentifier:@\"MyReuseIdentifier\"];\n\treturn cell;\n}\n```\n\t\nMake sure to call dequeueReusableCellWithIdentifier:reuseIdentifier method and **NOT** dequeueReusableCellWithIdentifier:reuseIdentifier:**forIndexPath:** one. They perform different logic and a crash will occure on wrong method use. \n\n#### Storyboards\n\nStoryboards are not supported, cached cells should be registered from code. \nNevertheless, if you strongly require storyboard usage then you could swizzle basic UITableView's registerNib/registerClass methods for your own and call. But I won't recommend this solution for it tampers UITableView mechanism.\n\n## Best Practises\n\nAs you know any cache consumes some memory. Best advice I could give is to keep track of your tableViews and free them as soon as possible. Having too many tableViews may cause memory pressure on your app. \n\n## License\n\nUITableView+Cache is available under the MIT license. See the LICENSE file for more info.\n\n## Author\n\n[Mehdzor](https://github.com/mehdzor)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKilograpp%2FUITableView-Cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKilograpp%2FUITableView-Cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKilograpp%2FUITableView-Cache/lists"}