SuggestionsBox 是一个 iOS 库,用于聚合关于建议、功能或评论的用户反馈,以帮助您打造更好的产品。
运行示例应用并体验它! 示例应用
要运行示例项目,请克隆仓库,然后在 Example 目录中首先运行 pod install
。
需要 iOS SDK 版本 > 8.0
需要 Swift 3.0
要在 Xcode 项目中使用 CocoaPods 集成 MEVHorizontalContacts,请在 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
pod 'SuggestionsBox'
然后,运行以下命令
$ pod install
要手动在 Xcode 项目中集成 SuggestionsBox,只需将 /Pod/Classes/ 文件夹中的文件包含到您的应用程序的 Xcode 项目中。
然后,在您的类中导入以下文件
import SuggestionsBox
import SuggestionsBox
class ViewController: UIViewController, SuggestionsBoxDelegate {
}
let suggestionsBox = SuggestionsBox()
suggestionsBox.delegate = self
SuggestionsBoxTheme.user = "Manuel"
SuggestionsBoxTheme.appName = "SuggestionsBox"
SuggestionsBoxTheme.title = "SuggestionsBox"
SuggestionsBoxTheme.headerText = "Suggest a new feature, tweak, improvement... We'd love to hear your sugestions!"
SuggestionsBoxTheme.footerText = "Powered by SuggestionsBox"
SuggestionsBoxTheme.newSuggestionFooterText = "Powered by SuggestionsBox"
SuggestionsBoxTheme.newCommentFooterText = "Powered by SuggestionsBox"
SuggestionsBoxTheme.navigationBarHeartColor = UIColor.redColor()
SuggestionsBoxTheme.tableSeparatorColor = UIColor.groupTableViewBackgroundColor()
SuggestionsBoxTheme.tableCellBackgroundColor = UIColor.whiteColor()
SuggestionsBoxTheme.tableCellTitleTextColor = UIColor.blackColor()
SuggestionsBoxTheme.tableCellDescriptionTextColor = UIColor.lightGrayColor()
let navigationBar = UINavigationController.init(rootViewController: suggestionsBox)
self.presentViewController(navigationBar, animated: true, completion: nil)
// MARK : SuggestionsBoxDelegate Methods
func suggestions() -> Array<Suggestion> {
return self.featureRequests
}
func commentsForSuggestion(suggestion: Suggestion) -> Array<Comment> {
return self.comments.filter({ $0.suggestionId == suggestion.suggestionId })
}
func newSuggestionAdded(newSuggestion: Suggestion) {
// Refresh online data
self.featureRequests.append(newSuggestion)
}
func newCommentForSuggestionAdded(suggestion: Suggestion, newComment: Comment) {
// Refresh online data
self.comments.append(newComment)
}
func suggestionFavorited(suggestion: Suggestion) {
// Refresh online data
// Refresh local data
let index = self.featureRequests.indexOf(suggestion)
self.featureRequests[index!] = suggestion
}
func suggestionUnFavorited(suggestion: Suggestion) {
// Refresh online data
// Refresh local data
let index = self.featureRequests.indexOf(suggestion)
self.featureRequests[index!] = suggestion
}
SuggestionsBox 在 MIT 协议下可用。有关更多信息,请参阅 LICENSE.md 文件。