Swift Mac 实用工具

支持在 Mac 上开发 Swift 代码的代码。

扩展并依赖于 Swift-General-Utility。

内容

执行

使用 Process 运行系统命令,并返回 stdout 的内容,或者如果状态非零,则抛出 stderr。虽然您可以使用单个字符串或(cmd-path, argument-array)来调用此方法,但后一种方法更受推荐。

类型实用工具

FileManager 实用工具

String 实用工具

URL 实用工具

安装

项目 > Swift Packages > 安装

https://github.com/erica/https://github.com/erica/Swift-Mac-Utility

SwiftPM

dependencies: [
.package(url: "https://github.com/erica/Swift-Mac-Utility", from: "x.x.x"), // replace with version
],
targets: [
    .target(
        name: "TARGET-NAME",
        dependencies: [
           .product(name: "MacUtility", package: "Swift-Mac-Utility"),
        ],
    ),
],