All Projects → HsiaohuiHsiang → Somo

HsiaohuiHsiang / Somo

Licence: mit
Somo is a iOS Skeleton-style animation library that's simple enough,and in objective-c

Projects that are alternatives of or similar to Somo

Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+872.91%)
Mutual labels:  skeleton, ios-animation
Skeletonview
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
Stars: ✭ 10,804 (+3513.38%)
Mutual labels:  skeleton, ios-animation
gulp-nunjucks-boilerplate
A scalable Gulp generated Nunjucks boilerplate.
Stars: ✭ 14 (-95.32%)
Mutual labels:  skeleton
Skeletonui
☠️ Elegant skeleton loading animation in SwiftUI and Combine
Stars: ✭ 275 (-8.03%)
Mutual labels:  skeleton
aurelia-typescript-webpack-starter
A minimal Aurelia starter kit written in TypeScript and built using webpack.
Stars: ✭ 28 (-90.64%)
Mutual labels:  skeleton
cakephpvue-spa
A CakePHP + VueJS single page application skeleton/boilerplate.
Stars: ✭ 40 (-86.62%)
Mutual labels:  skeleton
csharp-ddd-skeleton
🦈✨ C# DDD Skeleton: Bootstrap your new C# projects applying Hexagonal Architecture and Domain-Driven Design patterns
Stars: ✭ 67 (-77.59%)
Mutual labels:  skeleton
react-interval-rerender
render props component that rerenders its children at regular intervals
Stars: ✭ 16 (-94.65%)
Mutual labels:  skeleton
Skeleton
Skeleton Android
Stars: ✭ 293 (-2.01%)
Mutual labels:  skeleton
koleton
The easiest library to show skeleton screens in an Android app.
Stars: ✭ 84 (-71.91%)
Mutual labels:  skeleton
Ngx Skeleton Loader
Make beautiful, animated loading skeletons that automatically adapt to your Angular apps
Stars: ✭ 278 (-7.02%)
Mutual labels:  skeleton
vimwiki-skel
Skeleton for seeding new Vimwiki instances
Stars: ✭ 18 (-93.98%)
Mutual labels:  skeleton
netbox-plugin-skeleton
Skeleton for starting NetBox plugins
Stars: ✭ 15 (-94.98%)
Mutual labels:  skeleton
Flawless Ios
Awesome iOS guides from the community, shared on Flawless iOS Medium blog 👉
Stars: ✭ 260 (-13.04%)
Mutual labels:  ios-animation
MagicMirror-Module-Template
Template module for MagicMirror
Stars: ✭ 54 (-81.94%)
Mutual labels:  skeleton
Zephir
Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.
Stars: ✭ 3,086 (+932.11%)
Mutual labels:  skeleton
Kinetic
A flexible tweening library for iOS in Swift similar to GSAP's TweenMax.
Stars: ✭ 54 (-81.94%)
Mutual labels:  ios-animation
polypack
🔥 Polypack - Webpack build stack with focus on performance 🔥
Stars: ✭ 38 (-87.29%)
Mutual labels:  skeleton
node-boilerplate
Node Typescript Boilerplate for Microservices. Skeleton for Node.js Apps written in TypeScript (with Setup Instructions for ESLint, Prettier, and Husky)
Stars: ✭ 92 (-69.23%)
Mutual labels:  skeleton
Slim Api Skeleton
Slim 3 API skeleton project for Composer
Stars: ✭ 296 (-1%)
Mutual labels:  skeleton

  • [x] iOS 7.0+
  • [x] 多样式
  • [x] 轻量级,核心实现仅仅是对UIView进行扩展
  • [x] 可以自定义
  • [x] 支持不同高度的cell
Solid GradientHorizontal GradientVertical Oblique

集成

pod 'Somo'

使用

#import "Somo.h" 
  • 当需要某一个UIView拥有Skeleton效果时,只需遵守协议,实现一个必要方法:
@required
/**
 *  Example:
	 SomoView * s0 = [[SomoView alloc] initWithFrame:CGRectMake(10, 20, 70, 70)];
	 SomoView * s1 = [[SomoView alloc] initWithFrame:CGRectMake(100, 30, 200, 15)];
	 SomoView * s2 = [[SomoView alloc] initWithFrame:CGRectMake(100, 70, 100, 15)];

	return @[s0,s1,s2];
 *
 @return array of SomoViews
 */
- (NSArray<SomoView *> *)somoSkeletonLayout;
  • Somo对UIView进行了扩展,开发者调用即可拥有Skeleton效果:
- (void)beginSomo;
- (void)endSomo; 

UITableView-skeleton

在常见场景中,数据请求未着陆前,UITableView中所有visibleCells都应该呈现skeleton效果。为了达到这种效果,

您不必再编写更多的代码。Somo中有一个遵循<UITableViewDataSource,UITableViewDelegate>协议的SomoDataSourceProvider类,

您只需要按照该类指定的初始化方法构造一个实例,数据未着陆前,将tableview实例的datasource和delegate指向构造出

的SomoDataSourceProvider实例。当数据着陆后,将tableview的datasource和delegate指向controller或其他。

  • 数据着陆前:

//将tableview的datasource指向SomoDataSourceProvider
//当数据加载完成后,将tableview的datasource指向self

//cell高度相同时使用该方法初始化
self.provider = [SomoDataSourceProvider dataSourceProviderWithCellReuseIdentifier:@"id"];
 
//cell高度不同时
 
self.provider = [[SomoDataSourceProvider alloc] initWithTableViewCellBlock:^UITableViewCell<SomoSkeletonLayoutProtocol> *(UITableView *tableView, NSIndexPath *indexPath) {
		if(indexPath.row%2 == 0){
			return [tableView dequeueReusableCellWithIdentifier:@"id" forIndexPath:indexPath];
		}else{
			return [tableView dequeueReusableCellWithIdentifier:@"oid" forIndexPath:indexPath];
		} 
	} heightBlock:^CGFloat(UITableView *tableview, NSIndexPath *indexPath) {
		if(indexPath.row%2 == 0){
			return 120;
		}else{
			return 80;
		}
	}];
	
self.tableView.dataSource = self.provider;
self.tableView.delegate = self.provider;
  • 数据着陆后:
#pragma mark - 
self.tableView.dataSource = self;
self.tableView.delegate = self;
//============================
[self.tableView reloadData];
  • 注意点: 不要对SomoDataSourceProvider做定制。必须实现中的一个方法:
#pragma mark - 在这里必调用 endSomo
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
	[cell endSomo];
}
  • UICollectionView skeleton
  • 数据着陆前:
self.provider = [SomoDataSourceProvider dataSourceProviderWithCellReuseIdentifier:@"id"];
self.collectionView.dataSource = self.provider;
self.collectionView.delegate = self.provider;
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
	[cell endSomo];
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].