https://github.com/appcraftconsulting/producthunt
Product Hunt badge for iOS
https://github.com/appcraftconsulting/producthunt
badge cocoapods product-hunt swift swiftui uibutton
Last synced: 6 months ago
JSON representation
Product Hunt badge for iOS
- Host: GitHub
- URL: https://github.com/appcraftconsulting/producthunt
- Owner: appcraftconsulting
- License: mit
- Archived: true
- Created: 2020-09-17T14:01:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-15T14:28:11.000Z (over 5 years ago)
- Last Synced: 2025-11-18T09:23:48.206Z (7 months ago)
- Topics: badge, cocoapods, product-hunt, swift, swiftui, uibutton
- Language: Swift
- Homepage: https://www.producthunt.com
- Size: 2.7 MB
- Stars: 34
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Product Hunt badge for iOS.
### [Product Hunt](https://www.producthunt.com) surfaces the best new products, every day. It's a place for product-loving enthusiasts to share and geek out about the latest mobile apps, websites, hardware projects, and tech creations.
>[...] Product Hunt has become a must-read site in Silicon Valley.

>[...] Product Hunt is an online community that caters to the tech product fanatics.

>[Product Hunt] ballooned in popularity since its humble beginnings and has since become a destination site where folks could submit and vote on their favorite tech products.

>[...] Product Hunt has evolved from a small email list into a must-read for those in the tech and startup space to discover the next great product.

## Features
- [X] Dark mode support
- [X] Data persistence
- [X] Auto refresh every 5 minutes
## Requirements
- Swift 5.0
- Xcode 11.x
## Implement Product Hunt - UIKit
1. Import the ProductHunt framework in your `UIApplicationDelegate`:
```swift
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 (https://www.producthunt.com/v2/oauth/applications)
```swift
PHManager.shared.configure(forPost: .slug("timizer"), token: "")
```
3. In the view controller, override the `viewDidLoad` method to set the presenting view controller of the `PHManager` object.
```swift
PHManager.shared.presentingViewController = self
```
4. 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`.
## Implement Product Hunt - SwiftUI
1. Import the ProductHunt framework in your view struct:
```swift
import ProductHunt
```
2. Add the `ProductHuntButton` to your view with:
- The post that will be linked to the button (either defined by slug or id)
- Your Product Hunt developer token (https://www.producthunt.com/v2/oauth/applications)
```swift
ProductHuntButton(post: .slug(""), token: "")
.frame(width: 260.0, height: 60.0, alignment: .center)
.padding(10.0)
```
## Installation
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
You want to add pod `'ProductHunt', '~> 1.0'` similar to the following to your Podfile:
```rb
target 'MyApp' do
pod 'ProductHunt', '~> 1.0'
end
```
Then run a `pod install` inside your terminal, or from CocoaPods.app.
### [Swift Package Manager](https://swift.org/package-manager/)
1. Using Xcode 11 or above go to *File* > *Swift Packages* > *Add Package Dependency*
2. Paste the project URL: https://github.com/appcraftstudio/producthunt.git
3. Click on next and select the project target
## Contributors ✨
| Name | GitHub | Twitter |
| :------------------ | :------------------------------------------- | :---------------------------------------------------- |
| **François Boulais** | [**frboulais**](https://github.com/frboulais) | [**@frboulais**](https://twitter.com/frboulais) |
| **Julien Lacroix** | [**JulienLacr0ix**](https://github.com/JulienLacr0ix) | [**@JulienLacr0ix**](https://twitter.com/JulienLacr0ix) |
---
Copyright © 2020 App Craft Studio. All rights reserved.
