Manager 使用 Map + 双向链表 数据结构管理,类似LRU缓存淘汰算法。
所有逻辑处理在 Manger中, 展示视图只需要在manager 回调时 展示、更新、隐藏,逻辑处理 和 UI 没有耦合。
///自定义配置样式(在ShowView 初始化之前配置)
let configuartion = Configuration.default
configuartion.showDuration = 0.2
...
///创建manager
let manager = GiftManager<Gift>() //可自定义Model,遵守GiftShowType 协议。这里以提供的默认的 Gift 为例
manager.setupViews(views)
///将接收到的数据添加到manager
let model = Gift()
model.giftID = ...
manager.receive(value: model)
GiftComponent is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'GiftComponent'
U7426, u7426fenglongfei@163.com
GiftComponent is available under the MIT license. See the LICENSE file for more info.