灵活的版本历史记录:与大多数“最新内容”界面库不同,Recap 可以显示多个版本,展示你应用的完整功能历史记录。
无需代码,没有问题:由简单的 Markdown 文件驱动,本地存储或远程加载。
内置自定义:开箱即用地提供美观、标准化的界面,同时提供完全自定义功能,以匹配任何应用的设计语言。
语义版本控制支持:简单的逻辑可帮助确定何时显示“最新内容”界面。
设置一个屏幕来显示你应用的发布版本非常简单
// Initialize releases from a markdown file in your app's bundle
extension [Release] {
static var appReleases: [Release] {
ReleasesParser(fileName: "Releases").releases
}
}
// Create and display the RecapScreen
RecapScreen(releases: .appReleases)
这就是你开始需要的一切!
你的发布版本在一个简单的 markdown 文件中定义,具有非常简单的规范
# Version Number: [String] (Supports arbitrary number formats such as 1, 1.0, or 1.0.0)
## Release Title: [String]
### Semantic Version Change Type: [Major | Minor | Patch]
- title: [String] (Feature Title)
- description: [String] (Feature Description)
- symbol: [String] (SF Symbol Identifier)
- color: [String] (Hex Color Code or System Color Name)
注意
有关支持的系统颜色名称的完整列表,请参阅 Sources/Recap/Internal/Color+SystemNames.swift
。
# 1.1
## New Features ❤️
### Minor
- title: Super Cool Feature #1
- description: You won't believe how this works
- symbol: sparkles
- color: cyan
- title: Super Cool Feature #2
- description: You will believe how this one works though
- symbol: text.magnifyingglass
- color: blue
- title: Super Cool Feature #3
- description: This feature is for the nerds in the house
- symbol: apple.terminal.on.rectangle
- color: orange
# 1.0.1
## Bug Fixes! 🐛
### Patch
- title: Welcome to some bug fixes!
- description: My bad y'all…
- symbol: ladybug.circle
- color: #FFC933
# 1.0
## Introducing Recap 🥳
### Major
- title: Welcome to Recap
- description: It's live! 🥰
- symbol: party.popper
- color: #F72585
只需几行 markdown 代码,我们就构建了一个具有三个页面的发布版本屏幕,具有一致的外观和感觉。
Recap 提供了各种修饰符来定制发布版本屏幕,使其符合你应用的视觉形象
// Available customization modifiers
func recapScreenStartIndex(_ startIndex: RecapScreenStartIndex) -> some View
func recapScreenTitleStyle(_ style: some ShapeStyle) -> some View
func recapScreenDismissButtonStyle(_ style: some ShapeStyle) -> some View
func recapScreenDismissButtonStyle(_ backgroundStyle: some ShapeStyle, _ foregroundStyle: some ShapeStyle) -> some View
func recapScreenDismissButtonTitle(_ title: LocalizedStringResource) -> some View
func recapScreenIconFillMode(_ style: IconFillMode) -> some View
func recapScreenIconAlignment(_ alignment: VerticalAlignment) -> some View
func recapScreenPageIndicatorColors(selected: Color, deselected: Color) -> some View
func recapScreenBackground(_ style: AnyShapeStyle?) -> some View
func recapScreenBackground(_ color: Color) -> some View
func recapScreenPadding(_ insets: EdgeInsets) -> some View
func recapScreenHeaderSpacing(_ spacing: CGFloat) -> some View
func recapScreenItemSpacing(_ spacing: CGFloat) -> some View
func recapScreenDismissAction(_ dismissAction: (() -> Void)?) -> some View
使用示例
RecapScreen(releases: .appReleases)
.recapScreenTitleStyle(LinearGradient(colors: [.purple, .pink, .orange, .yellow], startPoint: .topLeading, endPoint: .bottomTrailing))
.recapScreenDismissButtonStyle(Color.pink, Color.white)
.recapScreenIconFillMode(.gradient)
.recapScreenPageIndicatorColors(
selected: Color.pink,
deselected: Color.gray
)
RecapScreen 还支持前导视图和尾随视图
RecapScreen(
releases: .plinkyReleases
leadingView: {
UpcomingRoadmapView()
}, trailingView: {
SupportView()
}
)
.recapScreenStartIndex(.release())
// Alternatively: .recapScreenStartIndex(.leadingView) or .recapScreenStartIndex(.trailingView)
在我的应用 Plinky 中,我使用前导视图在最新功能之前显示应用的即将推出的路线图,尾随视图显示一个支持屏幕,供人们在浏览功能列表后与我联系。
Recap 包含一个 SemanticVersion
类型,以帮助确定何时显示“最新内容”屏幕。这是一个如何使用它的示例
Recap 捆绑了一个有用的实用程序,用于选择何时显示“最新内容”屏幕。你可以使用 SemanticVersion
将应用的当前版本与上次启动的版本进行比较,以确定是否应显示“最新内容”屏幕。我建议根据你的需要定制逻辑,但这是一个如何使用的基本示例。
var shouldDisplayRecapScreen: Bool {
let currentVersionString = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
let previousVersionString = "1.0.0" // You should decide the best way to store the user's last launched version number, UserDefaults is a useful option.
guard let currentVersionString else { return false }
guard let previousVersionString else { return false }
let currentVersion = SemanticVersion(version: currentVersionString)
let previousVersion = SemanticVersion(version: previousVersionString)
// Show screen if major or minor version has increased
return currentVersion.major > previousVersion.major || currentVersion.minor > previousVersion.minor
}
此逻辑在以下情况下显示 RecapScreen
尝试使用 演示项目 试试 Recap,看看它是否适合你应用的需求。 📱
Swift Package Manager 是一种自动化 Swift 代码分发的工具,并集成到 Swift 构建系统中。
设置好你的 Swift 包后,添加 Recap 作为依赖项就像将其添加到 Package.swift
的依赖项值一样简单。
dependencies: [
.package(url: "https://github.com/mergesort/Recap.git", .upToNextMajor(from: "1.0.0"))
]
如果你不喜欢使用 SPM,你可以通过复制文件手动将 Recap 集成到你的项目中。
大家好,我是 Joe,我在网上到处都是,尤其是在 Threads 上。
有关如何使用 Recap 的更多信息,请参阅许可证。
Recap 是一项充满爱的工作,旨在帮助开发人员构建更好的应用程序,使你更容易释放你的创造力,并为你自己和你的用户创造一些令人惊叹的东西。如果你觉得 Recap 有价值,我将非常感谢你考虑帮助赞助我的开源工作,这样我就可以继续从事像 Recap 这样的项目,以帮助像你这样的开发人员。