appcraftconsulting/producthunt
Product Hunt badge for iOS
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
- Import the ProductHunt framework in your
UIApplicationDelegate:
import ProductHunt- Configure the
PHManagershared instance in your app'sapplication: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)
PHManager.shared.configure(forPost: .slug("timizer"), token: "<YOUR_PRODUCT_HUNT_TOKEN>")- In the view controller, override the
viewDidLoadmethod to set the presenting view controller of thePHManagerobject.
PHManager.shared.presentingViewController = self- Add a
PHButtonto 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 toPHButton.
<p align="center"> <br> <img src="https://github.com/appcraftstudio/producthunt/raw/master/Images/snapshot-product-hunt-button.png" width="260"> </p>
Implement Product Hunt - SwiftUI
- Import the ProductHunt framework in your view struct:
import ProductHunt- Add the
ProductHuntButtonto 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)
ProductHuntButton(post: .slug("<YOUR_SLUG>"), token: "<YOUR_PRODUCT_HUNT_TOKEN>")
.frame(width: 260.0, height: 60.0, alignment: .center)
.padding(10.0)<p align="center"> <br> <img src="https://github.com/appcraftstudio/producthunt/raw/master/Images/screenshot-swiftui.png" width="800"> </p>
Installation
CocoaPods
You want to add pod 'ProductHunt', '~> 1.0' similar to the following to your Podfile:
target 'MyApp' do
pod 'ProductHunt', '~> 1.0'
endThen run a pod install inside your terminal, or from CocoaPods.app.
Swift Package Manager
- Using Xcode 11 or above go to File > Swift Packages > Add Package Dependency
- Paste the project URL: https://github.com/appcraftstudio/producthunt.git
- Click on next and select the project target
Contributors ✨
| Name | GitHub | Twitter | | :------------------ | :------------------------------------------- | :---------------------------------------------------- | | François Boulais | frboulais | @frboulais | | Julien Lacroix | JulienLacr0ix | @JulienLacr0ix |
<a href="https://www.producthunt.com/posts/product-hunt-badge-for-ios-2?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-product-hunt-badge-for-ios-2" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=263397&theme=dark" alt="Product Hunt badge for iOS - Swift framework to add Product Hunt badge in your iOS apps! | Product Hunt Embed" style="width: 250px; height: 54px;" width="250" height="54" /></a>
<a href="https://www.buymeacoffee.com/appcraftstudio" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
Copyright © 2020 App Craft Studio. All rights reserved.
Package Metadata
Repository: appcraftconsulting/producthunt
Homepage: https://www.producthunt.com
Stars: 34
Forks: 6
Open issues: 0
Default branch: master
Primary language: swift
License: MIT
Topics: badge, cocoapods, product-hunt, swift, swiftui, uibutton
README: README.md
Archived: yes