Product Hunt badge for iOS

Swift framework to embed native Product Button button.


We love using Product Hunt since it’s a really performing way to introduce our new projects. That’s why we’ve developed this little framework to embed Product Hunt badge. It’s a UIButton subclass that uses Product Hunt API to synchronize the given votes count every 5 minutes.

Here is the introducing tweet:



  • Dark mode support
  • Data persistence
  • Auto refresh every 5 minutes


  • Swift 5.0
  • Xcode 11.x

Implement Product Hunt

  1. Import the ProductHunt framework in your UIApplicationDelegate:
    import ProductHunt
  2. Configure the PHManager shared instance in your app’s application:didFinishLaunchingWithOptions: method with:
    • The post that will be linked to the PHButton (either defined by slug or id)
    • Your Product Hunt developer token (
PHManager.shared.configure(forPost: .slug("timizer"), token: "Ou0qvqpdX7dT1Y4h4CSK3aKMW6-BaxzE6MxDNeop1Zk")
  1. In the view controller, override the viewDidLoad method to set the presenting view controller of the PHManager object.
    PHManager.shared.presentingViewController = self
  2. Add a PHButton to your storyboard, XIB file, or instantiate it programmatically. To add the button to your storyboard or XIB file, add a View and set its custom class to PHButton.



You want to add pod 'ProductHunt', '~> 1.0' similar to the following to your Podfile:

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

Then run a pod install inside your terminal, or from

Swift Package Manager

  1. Using Xcode 11 or above go to File > Swift Packages > Add Package Dependency
  2. Paste the project URL:
  3. Click on next and select the project target

Product Hunt badge for iOS (Unofficial) - Swift code to add Product Hunt badge in your iOS apps | Product Hunt
Open in GitHub