Swift

Product Hunt iOS 徽章。

Product Hunt 每天都会展示最好的新产品。 这是一个让热爱产品的人们分享和沉迷于最新的移动应用程序、网站、硬件项目和技术创造的地方。

[...] Product Hunt 已经成为硅谷必读的网站。

[...] Product Hunt 是一个迎合技术产品爱好者的在线社区。

[Product Hunt] 自其卑微的开端以来,人气飙升,并已成为一个人们可以提交和投票选出他们最喜欢的科技产品的目的地网站。

[...] Product Hunt 已经从一个小型邮件列表发展成为科技和创业领域发现下一个伟大产品的必读之选。

特性

要求

实现 Product Hunt - UIKit

  1. 在您的 UIApplicationDelegate 中导入 ProductHunt 框架
import ProductHunt
  1. 使用以下内容在您的应用程序的 application:didFinishLaunchingWithOptions: 方法中配置 PHManager 共享实例:
PHManager.shared.configure(forPost: .slug("timizer"), token: "<YOUR_PRODUCT_HUNT_TOKEN>")
  1. 在视图控制器中,重写 viewDidLoad 方法以设置 PHManager 对象的 presenting 视图控制器。
PHManager.shared.presentingViewController = self
  1. PHButton 添加到您的 storyboard、XIB 文件或以编程方式实例化它。 要将按钮添加到您的 storyboard 或 XIB 文件,请添加一个 View 并将其自定义类设置为 PHButton


实现 Product Hunt - SwiftUI

  1. 在您的视图结构中导入 ProductHunt 框架
import ProductHunt
  1. 使用以下内容将 ProductHuntButton 添加到您的视图:
ProductHuntButton(post: .slug("<YOUR_SLUG>"), token: "<YOUR_PRODUCT_HUNT_TOKEN>")
  .frame(width: 260.0, height: 60.0, alignment: .center)
  .padding(10.0)


安装

CocoaPods

您需要将类似于以下内容的 pod 'ProductHunt', '~> 1.0' 添加到您的 Podfile 中

target 'MyApp' do
  pod 'ProductHunt', '~> 1.0'
end

然后在您的终端或从 CocoaPods.app 中运行 pod install

Swift Package Manager

  1. 使用 Xcode 11 或更高版本,转到File > Swift Packages > Add Package Dependency
  2. 粘贴项目 URL:https://github.com/appcraftstudio/producthunt.git
  3. 单击下一步并选择项目目标

贡献者 ✨

姓名 GitHub Twitter
François Boulais frboulais @frboulais
Julien Lacroix JulienLacr0ix @JulienLacr0ix

Product Hunt badge for iOS - Swift framework to add Product Hunt badge in your iOS apps! | Product Hunt Embed

Buy Me A Coffee

版权所有 © 2020 App Craft Studio。 保留所有权利。