EngagingChoice 0.1.4

EngagingChoice 0.1.4

shahwal khan 维护。



 
依赖关系
Alamofire~> 4.7
SDWebImage~> 4.0
 

  • gitforengaging

EngagingChoice

CI Status Version License Platform

这个库提供了一个网格视图来显示媒体内容,并驱动一个视图来显示 Engaging Choice图标。

特性

ECGridManager 是一个单例类,用于在 appDelegate 类中设置 Secret key。ECGridView 类用于 ECPoweredByView 来显示 Engaging Choice图标。ECMediaContentManager 是一个单例类,用于获取媒体内容及其细节。

要求

  • iOS 11.0 或更高版本
  • Xcode 9.4.1 或更高版本

如何使用

注意:您必须在您的 app 的 Info.plist 文件中提供描述和 key NSLocationWhenInUseUsageDescription。

  1. 第一步:ECGridManager 提供配置的 Secret key
import EngagingChoice

ECGridManager.shared.config(secretKey: "SECRET_KEY") 

将 SECRET_KEY 替换为发布者的 secret key,并在 appDelegate 类的 didFinishLaunchingWithOptions 中添加以上代码行

  1. 第二步:ECMediaContent
import EngagingChoice

ECMediaContentManager.shared.contentList(offset: 0, limit: 10) { (mediaContent) in
// Get response here
}

偏移量和限制是可选的,但您可以使用这些字段进行分页,通过在参数中传递偏移量和限制。

并且您需要调用以下方法来获取媒体内容的细节,这是获取媒体内容细节的必需方法。

import EngagingChoice

ECMediaContentManager.shared.contentDetail(contentId: MEDIA_CONTENT_ID) { (conent) in
// Get Media Content detail
}
  1. 第三步
  • ECGridView 使用

在故事板中,将 UIView 拖到任何视图中,并应用 ECGridView 类,使用以下函数来显示图片

import EngagingChoice

cell.coverImageView.setImage(with: URL(string: "http://www.domain.com/path/to/image.jpg"))

OR

cell.gridView.coverImageView.sd_setImage(with: url, placeholderImage: UIImage(name: "http://www.domain.com/path/to/image.jpg"), completed: nil)

OR

cell.gridView.coverImageView.image = UIImage(name: "FILE_NAME")
  1. 第四步
  • ECPoweredByView 使用
import EngagingChoice

let poweredByView = ECPoweredByView(frame: CGRect(x: 0, y: 0, width: 245, height: 23))
self.view.addSubview(poweredByView)

或者

ECPoweredByView 还可以从故事板中通过将 UIView 拖动到 UIViewController 中并赋予类 ECPoweredByView 使用。

示例

运行示例项目,先克隆仓库,然后从示例目录运行pod install

需求

安装

EngagingChoice可通过CocoaPods获得。要安装,只需将以下行添加到Podfile中

pod 'EngagingChoice'

作者

EngagingChoice,[email protected]

许可协议

EngagingChoice遵循MIT许可协议。更多信息请参阅LICENSE文件。