新增功能
描述
WhatsNew
当用户更新您的应用时会自动显示新功能的高级简短描述。这类似于苹果在 Pages、Numbers、Keynote、iMovie 和 TestFlight 等应用程序中发生的情况。
只需列出您的新功能(可选包含图标),自定义其外观和显示时机(例如,仅在主要更新时显示)。
使用
从 Example
目录运行示例项目,并查看 ViewController.swift
。
import WhatsNew
let whatsNew = WhatsNewViewController(items: [
WhatsNewItem.image(title: "Nice Icons", subtitle: "Completely customize colors, texts and icons.", image: #imageLiteral(resourceName: "love")),
WhatsNewItem.image(title: "Such Easy", subtitle: "Setting this up only takes 2 lines of code, impressive you say?", image: #imageLiteral(resourceName: "threed")),
WhatsNewItem.image(title: "Very Sleep", subtitle: "It helps you get more sleep by writing less code.", image: #imageLiteral(resourceName: "night")),
WhatsNewItem.text(title: "Text Only", subtitle: "No icons? Just go with plain text."),
])
whatsNew.presentIfNeeded(on: self)
一些在生产中使用《新增功能》的应用程序包括:
如果您在您的应用程序中使用了 WhatsNew
,请让我知道,我会确保将它添加到使用此库的应用程序列表中!
定制
存在许多可定制的属性和相关文档。
/// This method allows marking the current version as presented. This is useful in case you want to avoid showing WhatsNew to first-time users for example.
public static func markCurrentVersionAsPresented()
/// Defines when to present the What's New view controller. Check the `PresentationOption` enum for more details.
public var presentationOption: PresentationOption = .always
/// Closure invoked when the user dismisses the view controller.
public var onDismissal: (() -> Void)?
/// Text of the top title.
public var titleText: String = "What’s New"
/// Color of the top title.
public var titleColor: UIColor = .black
/// Font of the top title.
public var titleFont: UIFont = UIFont.systemFont(ofSize: 26, weight: .bold)
/// Title color of the feature items.
public var itemTitleColor: UIColor = .black
/// Subtitle color of the feature items.
public var itemSubtitleColor: UIColor = .black
/// Title font of the feature items
public var itemTitleFont: UIFont = UIFont.systemFont(ofSize: 20, weight: .bold)
/// Subtitle font of the feature items
public var itemSubtitleFont: UIFont = UIFont.systemFont(ofSize: 16, weight: .regular)
/// Text of the bottom button that dismisses the view controller.
public var buttonText: String = "Continue"
/// Text color of the bottom button that dismisses the view controller.
public var buttonTextColor: UIColor = .yellow
/// Text font of the bottom button that dismisses the view controller.
public var buttonFont: UIFont = UIFont.systemFont(ofSize: 16, weight: .regular)
/// Background color of the bottom button that dismisses the view controller.
public var buttonBackgroundColor: UIColor = .black
安装
WhatsNew
通过CocoaPods提供。要安装它,只需将以下行添加到您的Podfile
pod 'WhatsNew'
如果您更喜欢Carthage,也可以使用。将此行添加到您的Cartfile
。
github "BalestraPatrick/WhatsNew"
可用的Android版本在这里。
需求
iOS 9.0和Swift 4.0是必需的。
作者
我是Patrick Balestra。邮箱:[email protected] 推特:@BalestraPatrick。
许可证
WhatsNew
遵循MIT许可证。有关更多信息,请参阅LICENSE文件。