Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
dequan1331 committed Mar 3, 2019
1 parent 77a5a7f commit 644f5d8
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 150 deletions.
Empty file removed CHANGELOG-CN.md
Empty file.
Empty file removed CHANGELOG.md
Empty file.
18 changes: 7 additions & 11 deletions HybridPageKit.podspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
Pod::Spec.new do |s|
s.name = "HybridPageKit"
s.version = "0.2"
s.version = "1.0"
s.summary = "A high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App."
s.homepage = "https://github.com/dequan1331/HybridPageKit"
s.license = "MIT"
s.author = "dequanzhu"
s.platform = :ios, "8.0"
s.requires_arc = true
s.source = { :git => "https://github.com/dequan1331/HybridPageKit.git", :tag => "0.2" }
s.source_files = "HybridPageKit/HybridPageKit/HybridPageKit/ReusableWebView/**/*.{h,m}","HybridPageKit/HybridPageKit/HybridPageKit/HybridViewController/**/*.{h,m}","HybridPageKit/HybridPageKit/HybridPageKit/HybridPageKit.h"
s.public_header_files = "HybridPageKit/HybridPageKit/HybridPageKit/HybridPageKit.h","HybridPageKit/HybridPageKit/HybridPageKit/HybridViewController/HPKViewConfig.h","HybridPageKit/HybridPageKit/HybridPageKit/HybridViewController/HPKAbstractViewController.h","HybridPageKit/HybridPageKit/HybridPageKit/HybridViewController/HPKDefs.h","HybridPageKit/HybridPageKit/HybridPageKit/HybridViewController/HPKBaseViewController.h"
s.source = { :git => "https://github.com/dequan1331/HybridPageKit.git", :tag => s.version.to_s }
s.source_files = "HybridPageKit/HybridPageKit/HybridPageKit/**/*.{h,m}"
s.public_header_files = "HybridPageKit/HybridPageKit/HybridPageKit/*.h"

s.subspec 'WKWebViewExtension' do |ss|
ss.source_files = 'HybridPageKit/HybridPageKit/HybridPageKit/WKWebViewExtensions/**/*.{h,m}'
end

s.subspec 'ScrollReuseHandler' do |ss|
ss.source_files = 'HybridPageKit/HybridPageKit/HybridPageKit/ScrollReuseHandler/**/*.{h,m}'
end
s.test_spec 'HybridPageKitTests' do |test_spec|
test_spec.source_files = "HybridPageKit/HybridPageKit/HybridPageKitTests/*.{h,m}"
end
end
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 dequan1331
Copyright (c) 2019 dequanzhu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
159 changes: 75 additions & 84 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

>**HybridPageKit**是一个针对新闻类App高性能、易扩展、组件化的通用内容页实现框架。
>
>基于[ReusableNestingScrollview](https://github.com/dequan1331/ReusableNestingScrollview)[WKWebViewExtension](https://github.com/dequan1331/WKWebViewExtension)、以及[扩展阅读](https://dequan1331.github.io/)中关于内容页架构和性能的探索。
>基于[扩展阅读](https://dequan1331.github.io/)中关于内容页架构和性能的探索。
<br>

Expand All @@ -17,42 +17,44 @@

## 配置 & 安装

1. CocoaPods

-> HybridPageKit (0.1)
A high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App.
pod 'HybridPageKit', '~> 0.1'
- Homepage: https://github.com/dequan1331/HybridPageKit
- Source: https://github.com/dequan1331/HybridPageKit.git
- Versions: 0.1 [master repo]
- Subspecs:
- HybridPageKit/WKWebViewExtension (0.1)
- HybridPageKit/ScrollReuseHandler (0.1)

2. Cloning the repository
1. CocoaPods
```objc
//In your Podfile
pod "HybridPageKit", :testspecs => ["HybridPageKitTests"]
...
```

2. Carthage

```objc
//In your Cartfile
git "https://github.com/dequan1331/HybridPageKit.git" "master"
```

3. Cloning the repository


## 特性

> 强烈建议阅读[iOS新闻类App内容页技术探索](https://dequan1331.github.io/)
* 集成简单,几十行代码完成新闻类App的内容展示页框架,满足绝大多数使用场景
* 全部面向协议集成简单,几十行代码完成新闻类App的内容展示页框架,满足绝大多数使用场景
* 易于扩展,组件化管理高内聚低耦合,功能模块高度独立
* 使用并扩展WKWebView,在提高系统稳定性的同时,进行更加友好和全面的扩展
* 自动实现WKWebView全局复用、Native组件滚动复用、全局复用
* WebView中元素Native化实现,数据驱动,极大减少开发和维护成本,提升首屏速度
* 统一页面内滚动复用管理逻辑,简单易于集成和扩展,线程安全
* 使用并扩展WKWebView,在提高系统稳定性的同时,进行更加友好和全面的扩展
* 自动实现WKWebView全局复用、Native组件滚动复用、全局复用
* WebView中元素Native化实现,数据驱动,极大减少开发和维护成本,提升首屏速度
* 统一页面内滚动复用管理逻辑,简单易于集成和扩展,线程安全

## 子项目

* [WKWebViewExtension](https://github.com/dequan1331/WKWebViewExtension) : 一系列WKWebView的扩展。提供自定义长按MenuItems Bug修复、支持NSURLProtocol、清理iOS 8浏览器缓存等功能。
* [ReusableNestingScrollview](https://github.com/dequan1331/ReusableNestingScrollview) : 无需继承特殊ScrollView,无需继承特殊Model,状态丰富的,支持WKWebView、UIWebView、UIScrollView等滚动视图中subViews复用和回收组件。
* [iOS新闻类App内容页技术探索](https://dequan1331.github.io/)
## 相关阅读

## 快速使用
* [iOS新闻类App内容页技术探索](https://dequan1331.github.io/)


1.基于后台下发模板-数据分离的数据结构
## 快速使用


1. 基于后台下发模板-数据分离的数据结构

```json
{
Expand Down Expand Up @@ -102,83 +104,72 @@
}
```

2.生成对应UI组件的Model、View、Controller

```objc
//Model实现RNSModelProtocol协议
@interface ImageModel : NSObject<RNSModelProtocol>
//解析index
@property(nonatomic,copy,readwrite)NSString *index;
//保存当前组件的size
@property(nonatomic,assign,readwrite)CGRect frame;
@end

@implementation ImageModel
//实现RNSModelProtocol协议,对应传入Index,Frame,组件对应View,组件对应Controller,自定义context
RNSProtocolImp(_index,_frame, ImageView, ImageController, nil);
//解析数据
- (instancetype)initWithDictionary:(NSDictionary *)dic{}
@end

//自定义组件view
@interface ImageView : UIImageView
@end
```
3.生成UI组件对应的Controller,处理控制逻辑
2. 生成对应UI组件的Model、View

```objc
//Model实现HPKModelProtocol协议
@interface VideoModel : NSObject<HPKModelProtocol>
...
IMP_HPKModelProtocol(@"");

//组件管理逻辑,实现HPKComponentControllerDelegate协议
@interface ImageController : NSObject<HPKComponentControllerDelegate>
@end
//View实现HPKModelProtocol协议
@interface VideoView : UIImageView<HPKViewProtocol>
...
IMP_HPKViewProtocol()

@implementation ImageController
//选择性实现HPKComponentControllerDelegate中的方法,进行自定义业务逻辑处理
- (BOOL)shouldResponseWithComponentView:(__kindof UIView *)componentView
componentModel:(RNSModel *)componentModel{}
- (void)scrollViewWillDisplayComponentView:(__kindof UIView *)componentView
componentModel:(RNSModel *)componentModel{}
@end
```

4.内容页继承HPKViewController,返回支持组件Controller
3. 生成UI组件对应的Controller,处理控制逻辑
```objc
@interface VideoController : NSObject<HPKControllerProtocol>
...
- (nullable NSArray<Class> *)supportComponentModelClass {
return @[[VideoModel class]];
}
...
- (nullable Class)reusableComponentViewClassWithModel:(HPKModel *)componentModel {
return [VideoView class];
}
...
- (void)scrollViewWillDisplayComponentView:(HPKView *)componentView
componentModel:(HPKModel *)componentModel {
...
}
@interface HybridViewController : HPKViewController
@end

@implementation HybridViewController
// 返回支持的UI组件类型
- (NSArray<NSObject<HPKComponentControllerDelegate> *> *)getValidComponentControllers{
return @[
[[ImageController alloc]init],
];
- (void)controllerViewDidDisappear {
...
}
@end
```

5.填充数据渲染页面
4. 实现简单的内容页

```objc
...
_componentHandler = [[HPKPageHandler alloc] initWithViewController:self componentsControllers:@[VideoController ...];
...
[_componentHandler handleSingleScrollView:[[UIScrollView alloc] initWithFrame:self.view.bounds]];
...
[_componentHandler layoutWithComponentModels:@[VideoModel ...]];
...
```
- (void)setArticleDetailModel:(NSObject *)model //内容页数据,透传
htmlTemplate:(NSString *)htmlTemplate //内容页mustache格式HTML模板
webviewExternalDelegate:(id<WKNavigationDelegate>)externalDelegate //WebView external delegate,设置为self
webViewComponents:(NSArray<NSObject<RNSModelProtocol> *> *)webViewComponents //webview上的UI组件数据Model
extensionComponents:(NSArray<NSObject<RNSModelProtocol> *> *)extensionComponents; //extension区域上的UI组件数据Model
5. 实现复杂Hybrid类型的内容页
```objc
// in page viewController
...
_componentHandler = [[HPKPageHandler alloc] initWithViewController:self componentsControllers:@[VideoController ...];
...
[_componentHandler handleHybridPageWithContainerScrollView:[[UIScrollView alloc] initWithFrame:self.view.bounds] defaultWebViewClass:[HPKWebViewSubClass class] defaultWebViewIndex:1 webComponentDomClass:@"domClass" webComponentIndexKey:@"domAttrIndex"];
...
[_componentHandler layoutWithWebComponentModels:@[WebVideoModel ...]];
...
[_componentHandler layoutWithComponentModels:@[VideoModel ...];
...
```


## 证书

All source code is licensed under the [MIT License](https://github.com/dequan1331/HybridPageKit/blob/master/LICENSE).

## 联系方式

<img src="https://raw.githubusercontent.com/dequan1331/HybridPageKit/master/README-IMAGE/contact.png">


Binary file removed README-IMAGE/contact.png
Binary file not shown.
Loading

0 comments on commit 644f5d8

Please sign in to comment.