Diligence

build

SwiftUI 关于界面

概述

Diligence 是一个轻量级的 Swift 包,包含一系列 UI 控件,用于构建 macOS 和 iOS 应用程序的关于界面。

截图

iOS

Anytime (随时) StatusPanel (状态面板) OPL
anytime statuspanel opl

macOS

构建版本号

Diligence 支持符合以下结构的构建版本号

YYmmddHHMMxxxxxxxx

这些构建版本号保证始终递增,因此可以安全地用于 iOS 和 macOS 应用程序,同时还可以编码构建日期和提交信息。

如果 Diligence 检测到此格式的构建版本号,它将在关于界面中显示此附加信息。

生成构建版本号

Diligence 附带一个 Swift 命令行脚本,可用于生成合适的构建版本号。从 Diligence 根目录运行以下命令

scripts/build-number.swift
221021001716408432

这可以通过从命令行构建并设置 CURRENT_PROJECT_VERSION 环境变量来注入到您的项目构建中。 例如,存档 TinyBoard 项目的发布版本的命令行如下:

BUILD_NUMBER=`diligence/scripts/build-number.swift`
xcode_project \
    -scheme "TinyBoard" \
    -config Release \
    CURRENT_PROJECT_VERSION=$BUILD_NUMBER \
    archive

用法

iOS

AboutView {
  Action("InSeven Limited", url: URL(string: "https://inseven.co.uk")!)
  Action("Privacy Policy", url: URL(string: "https://anytime.world/privacy-policy")!)
  Action("Support", url: URL(address: "support@anytime.world", subject: "Anytime Support")!)
} acknowledgements: {
  Acknowledgements("Contributors") {
    Credit("Jason Morley", url: URL(string: "https://jbmorley.co.uk"))
    Credit("Pavlos Vinieratos", url: URL(string: "https://github.com/pvinis"))
    Credit("Sarah Barbour")
  }
  Acknowledgements("Graphics") {
    Credit("Anna Wilk")
  }
  Acknowledgements("Thanks") {
    Credit("Blake Merryman")
    Credit("Joanne Wong")
    Credit("Johannes Weiß")
    Credit("Lukas Fittl")
    Credit("Michael Dales")
    Credit("Michi Spevacek")
    Credit("Mike Rhodes")
    Credit("Sara Frederixon")
    Credit("Terrence Talbot")
    Credit("Tom Sutcliffe")
  }
} licenses: {
  License("Introspect", author: "Timber Software", filename: "introspect-license")
}

macOS

import SwiftUI

import Diligence

@main
struct BookmarksApp: App {

    var body: some Scene {
        WindowGroup {
            ContentView()
        }

        About {
            Action("InSeven Limited", url: URL(string: "https://inseven.co.uk")!)
            Action("Support", url: URL(address: "support@inseven.co.uk", subject: "Bookmarks Support")!)
        } acknowledgements: {
            Acknowledgements("Developers") {
                Credit("Jason Morley", url: URL(string: "https://jbmorley.co.uk"))
            }
            Acknowledgements("Thanks") {
                Credit("Blake Merryman")
                Credit("Joanne Wong")
                Credit("Lukas Fittl")
                Credit("Pavlos Vinieratos")
                Credit("Sara Frederixon")
                Credit("Sarah Barbour")
                Credit("Terrence Talbot")
            }
        } licenses: {
            License("Binding+mappedToBool", author: "Joseph Duffy", filename: "Binding+mappedToBool")
            License("Diligence", author: "Jason Morley", filename: "Diligence")
            License("Interact", author: "Jason Morley", filename: "interact-license")
            License("Introspect", author: "Timber Software", filename: "Introspect")
            License("SQLite.swift", author: "Stephen Celis", filename: "SQLite-swift")
            License("TFHpple", author: "Topfunky Corporation", filename: "TFHpple")
        }

    }
}

注意事项

Diligence 目前做出了一些假设,这些假设将在未来的更新中解决