一个SwiftUI包,用于快速构建应用程序引导。
这是我从我的应用程序Rex Tables中提取的一些代码 —— 本仓库中的演示应用程序是原始的Rex Tables引导。
MarkWalkthrough使用图像、文本和过渡效果的列表,并显示一个引导窗口,让用户浏览“幻灯片”。
你可以像这样在Markdown中定义引导幻灯片
| image | sticker | stickerOffset | stickerScale | transition | text |
| -------------- | -------- | ------------- | ------------ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Icon_256x256 | | | | swoosh,vanish | Welcome to Rex Tables! Rex allows you to work with ad-hoc spreadsheets generated on-the-fly from your text files. Click the arrows to advance |
| app-window-1 | | | | skid, | This is the Rex Tables window — write a regex at the top, the app finds matches in the source text and displays an interactive spreadsheet at the bottom |
...
一个简单的演示应用程序可能如下所示
struct DemoAppApp: App {
let viewModel = try! MarkWalkthroughModel(
from: Bundle.main.url(forResource: "Walkthrough", withExtension: "md")!
)
var body: some Scene {
WindowGroup {
MarkWalkthroughWindow(viewModel: viewModel, closeAction: {})
.background(Color("BackgroundColor"))
.frame(width: 650, height: 500, alignment: .top)
}
.windowResizability(.contentSize)
.windowStyle(.hiddenTitleBar)
}
}
MarkWalkthrough使用给定的幻灯片图像和文本构建视图,并可选择添加贴纸(如果已定义)
直接在Xcode中或通过SwiftPM使用此包。
dependencies: [
.package(url: "https://github.com/icanzilb/MarkWalkthrough", from: "0.6.0"),
]
MIT许可证,Marin Todorov (2023)