{"id":20358607,"url":"https://github.com/beatskitano/somo","last_synced_at":"2025-10-29T17:21:00.293Z","repository":{"id":52977754,"uuid":"111988451","full_name":"BeatsKitano/Somo","owner":"BeatsKitano","description":"Somo is a iOS Skeleton-style animation library that's simple enough,and in objective-c","archived":false,"fork":false,"pushed_at":"2022-06-02T13:14:02.000Z","size":3991,"stargazers_count":309,"open_issues_count":3,"forks_count":40,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-31T10:10:27.311Z","etag":null,"topics":["ios-animation","objective-c","skeleton","skeleton-framework","skeletonization"],"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/BeatsKitano.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":"2017-11-25T08:26:52.000Z","updated_at":"2025-03-17T08:36:08.000Z","dependencies_parsed_at":"2022-08-20T22:20:24.202Z","dependency_job_id":null,"html_url":"https://github.com/BeatsKitano/Somo","commit_stats":null,"previous_names":["xorshine/somo"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeatsKitano%2FSomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeatsKitano%2FSomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeatsKitano%2FSomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeatsKitano%2FSomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeatsKitano","download_url":"https://codeload.github.com/BeatsKitano/Somo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648978,"owners_count":20972945,"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":["ios-animation","objective-c","skeleton","skeleton-framework","skeletonization"],"created_at":"2024-11-14T23:27:53.655Z","updated_at":"2025-10-29T17:21:00.189Z","avatar_url":"https://github.com/BeatsKitano.png","language":"Objective-C","readme":"![](_logo.png)\n\n![](https://img.shields.io/packagist/l/doctrine/orm.svg)\n![](https://img.shields.io/cocoapods/v/{Somo}.svg?style=flat)\n![](https://img.shields.io/badge/platform-ios-lightgrey.svg)\n![](https://img.shields.io/badge/language-objc-orange.svg)\n![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHHHsiang%2FSomo.svg?type=shield)\n\n- [x] iOS 7.0+\n- [x] 多样式\n- [x] 轻量级，核心实现仅仅是对UIView进行扩展 \n- [x] 可以自定义\n- [x] 支持不同高度的cell\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"25%\"\u003e\n\u003ccenter\u003eSolid\u003c/center\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003ccenter\u003eGradientHorizontal\u003c/center\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003ccenter\u003eGradientVertical\u003c/center\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003ccenter\u003eOblique\u003c/center\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd width=\"25%\"\u003e\n\u003cimg src=\"solid.gif\"\u003e\u003c/img\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003cimg src=\"horizontal.gif\"\u003e\u003c/img\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003cimg src=\"vertical.gif\"\u003e\u003c/img\u003e\n\u003c/td\u003e\n\u003ctd width=\"25%\"\u003e\n\u003cimg src=\"oblique.gif\"\u003e\u003c/img\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n \n#### \u003ca id=\"somo_integrate\"\u003e\u003c/a\u003e集成\n```ruby\npod 'Somo'\n```\n#### \u003ca id=\"somo_usage\"\u003e\u003c/a\u003e使用\n```objective-c\n#import \"Somo.h\" \n```\n\n\n* 当需要某一个UIView拥有Skeleton效果时，只需遵守\u003cSomoSkeletonLayoutProtocol\u003e协议，实现一个必要方法：\n\t\n```objective-c\n@required\n/**\n *  Example:\n\t SomoView * s0 = [[SomoView alloc] initWithFrame:CGRectMake(10, 20, 70, 70)];\n\t SomoView * s1 = [[SomoView alloc] initWithFrame:CGRectMake(100, 30, 200, 15)];\n\t SomoView * s2 = [[SomoView alloc] initWithFrame:CGRectMake(100, 70, 100, 15)];\n\n\treturn @[s0,s1,s2];\n *\n @return array of SomoViews\n */\n- (NSArray\u003cSomoView *\u003e *)somoSkeletonLayout;\n```\n* Somo对UIView进行了扩展，开发者调用即可拥有Skeleton效果：\n```objective-c\n- (void)beginSomo;\n- (void)endSomo; \n```\n#### \u003ca id=\"somo_uitableview\"\u003e\u003c/a\u003eUITableView-skeleton\n在常见场景中，数据请求未着陆前，UITableView中所有visibleCells都应该呈现skeleton效果。为了达到这种效果，\n\n您不必再编写更多的代码。Somo中有一个遵循\u003cUITableViewDataSource,UITableViewDelegate\u003e协议的SomoDataSourceProvider类，\n\n您只需要按照该类指定的初始化方法构造一个实例，数据未着陆前，将tableview实例的datasource和delegate指向构造出\n\n的SomoDataSourceProvider实例。当数据着陆后，将tableview的datasource和delegate指向controller或其他。\n\n* 数据着陆前：\n\n```objective-c\n\n//将tableview的datasource指向SomoDataSourceProvider\n//当数据加载完成后，将tableview的datasource指向self\n\n//cell高度相同时使用该方法初始化\nself.provider = [SomoDataSourceProvider dataSourceProviderWithCellReuseIdentifier:@\"id\"];\n \n//cell高度不同时\n \nself.provider = [[SomoDataSourceProvider alloc] initWithTableViewCellBlock:^UITableViewCell\u003cSomoSkeletonLayoutProtocol\u003e *(UITableView *tableView, NSIndexPath *indexPath) {\n\t\tif(indexPath.row%2 == 0){\n\t\t\treturn [tableView dequeueReusableCellWithIdentifier:@\"id\" forIndexPath:indexPath];\n\t\t}else{\n\t\t\treturn [tableView dequeueReusableCellWithIdentifier:@\"oid\" forIndexPath:indexPath];\n\t\t} \n\t} heightBlock:^CGFloat(UITableView *tableview, NSIndexPath *indexPath) {\n\t\tif(indexPath.row%2 == 0){\n\t\t\treturn 120;\n\t\t}else{\n\t\t\treturn 80;\n\t\t}\n\t}];\n\t\nself.tableView.dataSource = self.provider;\nself.tableView.delegate = self.provider;\n```\n* 数据着陆后：\n```objective-c\n#pragma mark - \nself.tableView.dataSource = self;\nself.tableView.delegate = self;\n//============================\n[self.tableView reloadData];\n```\n* 注意点:\n不要对SomoDataSourceProvider做定制。必须实现\u003cUITableViewDelegate\u003e中的一个方法：\n```objective-c\n#pragma mark - 在这里必调用 endSomo\n- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{\n\t[cell endSomo];\n}\n``` \n\t\n* UICollectionView skeleton\n* 数据着陆前：\n```objective-c\nself.provider = [SomoDataSourceProvider dataSourceProviderWithCellReuseIdentifier:@\"id\"];\nself.collectionView.dataSource = self.provider;\nself.collectionView.delegate = self.provider;\n```\n```objective-c\n- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{\n\t[cell endSomo];\n}\n```\n\n\n## License\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHHHsiang%2FSomo.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FHHHsiang%2FSomo?ref=badge_large)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatskitano%2Fsomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeatskitano%2Fsomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatskitano%2Fsomo/lists"}