wishkit.io

应用内功能请求,轻松实现。

MIT License Swift 5.6 Twitter

WishKit 允许您的用户请求和投票应用程序中的功能,开箱即用 ✨

索引

UIKit

1. 在 Xcode 中添加 WishKit (v4.7.0) 作为依赖项。

https://github.com/wishkit/wishkit-ios.git

2. 使用您的 API 密钥配置 WishKit。

您可以在 wishkit.io 的管理仪表板中找到您的 API 密钥。
import UIKit
import WishKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
	WishKit.configure(with: "your_api_key")
        return true
    }
    
    ...
}

3. 现在您可以展示 WishKit viewController。

import UIKit
import WishKit

class HomeViewController: UIViewController {
    ...
  
    @objc func buttonTapped() {
        present(WishKit.viewController.withNavigation(), animated: true)  
    }
}
注意:如果您正在推送 WishKit.viewController,您无需调用 withNavigation()

SwiftUI

1. 在 Xcode 中添加 WishKit (v4.7.0) 作为依赖项。

https://github.com/wishkit/wishkit-ios.git

2. 在第一个视图中使用您的 API 密钥配置 WishKit。

您可以在 wishkit.io 的管理仪表板中找到您的 API 密钥。
import SwiftUI
import WishKit

struct ContentView: View {

    init() {
        WishKit.configure(with: "your-api-key")
    }
  
    ...
}

3. 现在在任何您想要的地方使用该视图!

import SwiftUI
import WishKit

struct ContentView: View {

    init() {
        WishKit.configure(with: "your-api-key")
    }

    var body: some View {
        WishKit.FeedbackListView().withNavigation()
    }
}
注意:如果父视图之一是 NavigationView/NavigationStack,您无需调用 withNavigation()

配置

您可以配置 WishKit 的许多 UI 元素。

// Allow user to undo their vote
WishKit.config.allowUndoVote = true

// Shows full description of a feature request in the list.
WishKit.config.expandDescriptionInList = true

// Hide comment section
WishKit.config.commentSection = .hide

// Position the Add-Button.
WishKit.config.buttons.addButton.bottomPadding = .large

// Show the status badge of a feature request (e.g. pending, approved, etc.).
WishKit.config.statusBadge = .show

// Hide the segmented control.
WishKit.config.buttons.segmentedControl.display = .hide

// Remove drop shadow.
WishKit.config.dropShadow = .hide

主题化

您可以主题化 WishKit 以适应您的应用颜色。 🎨

// This is for the Add-Button, Segmented Control, and Vote-Button.
WishKit.theme.primaryColor = .yellow

// Set the secondary color (this is for the cells and text fields).
WishKit.theme.secondaryColor = .set(light: .orange, dark: .red)

// Set the tertiary color (this is for the background).
WishKit.theme.tertiaryColor = .set(light: .gray, dark: .black)

// Segmented Control (Text color)
WishKit.config.buttons.segmentedControl.defaultTextColor = .setBoth(to: .white)

WishKit.config.buttons.segmentedControl.activeTextColor = .setBoth(to: .white)

// Save Button (Text color)
WishKit.config.buttons.saveButton.textColor = .set(light: .white, dark: .white)

用户细分

💰 收入指示:分享用户在您的应用中支付的金额。

// How much a user is paying per week or month or year.
// WishKit supports weekly, monthly and yearly payments.
WishKit.updateUser(payment: .monthly(7.99))

通过分享用户的收入,您将能够看到功能请求背后的“金额”。 这使您可以优先考虑只有 2 票但价值 13 美元的功能,而不是具有 7 票且价值 0 美元的功能。

📧 附加信息:与 WishKit 分享可选的用户信息。

// Email
WishKit.updateUser(email: "jobs@apple.com")

// Name
WishKit.updateUser(name: "Steve")

// If you manage user IDs yourself you can let WishKit prioritize it.
WishKit.updateUser(customID: "8AHD1IL03ACIP")

本地化

通过覆盖默认值来本地化 WishKit 使用的任何文本。

// Override the segmented control text to the german word for "Requested".
WishKit.config.localization.requested = "Angefragt"

// You can also assign NSLocalizedString.
WishKit.config.localization.cancel = NSLocalizedString("general.cancel", comment: "")

平台


示例项目

查看示例项目,了解设置愿望清单是多么容易!