GatheredKit

Tests Status codecov Compatible with macOS, iOS, watchOS, and tvOS SwiftPM Compatible MIT License

⚠️GatheredKit 目前处于预发布 Beta 阶段。API 不稳定,虽然唯一计划中的重大破坏性修复是引入结构化并发以确保线程安全。

GatheredKit 为 macOS、iOS、watchOS 和 tvOS 提供的各种数据源提供了一个一致的、面向协议的 API。

此代码源自 Gathered,因此得名和徽标。在 2.0 版本之前,Gathered 使用了 GatheredKit 的闭源版本。2.0 版本目前处于 Beta 阶段,可以通过 TestFlight 访问

文档可在网上查阅。此文档是针对 iOS 编译的。这不能完全涵盖项目中的所有符号,因此请查看项目以查看其他平台的文档。

特性

提供的库

核心库,GatheredKit,提供了其他库使用的协议,以及各种便利类型,例如 BasicProperty

其余的库各自提供一个或多个数据源。这样做是为了允许包含数据源的子集,这有助于文档编制、发现,并防止意外包含需要额外权限的 API,例如访问 IDFA。

每个库大致对应于 Apple 的一个框架。

GatheredKitCamera

GatheredKitCamera 提供对内置和外部摄像头的访问。可以使用 CameraProvider 查询已连接的摄像头。它包装了 AVFoundation 框架

GatheredKitDevice

GatheredKitDevice 提供了与当前设备相关的各种源。

在 iOS 上,它包装了 UIKit 框架,特别是 UIDevice

GatheredKitLocation

GatheredKitLocation 提供了 Location 数据源,该数据源用于访问由 GPS 和相关传感器提供的位置信息。它依赖于 Core Location 框架

GatheredKitMotion

GatheredKitMotion 提供了使用 CoreMotion 框架的数据源,例如 Accelerometer(加速度计)、Gyroscope(陀螺仪)和 Magnetometer(磁力计)。

GatheredKitProcessInfo

GatheredKitProcessInfo 提供了与进程运行的计算机相关的信息。

GatheredKitScreen

GatheredKitScreen 提供了对与设备关联的屏幕的访问。

未来的库

以下是在 Gathered 应用程序中可用但尚未添加到此开源项目中的源。

安装

SwiftPM

要通过 SwiftPM 安装,请将软件包添加到依赖项部分,并作为目标的依赖项

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/JosephDuffy/GatheredKit.git", branch: "main"),
    ],
    targets: [
        .target(name: "MyApp", dependencies: ["GatheredKit"]),
    ],
    ...
)

许可证

该项目根据 MIT 许可证发布。查看 LICENSE 文件以获取完整许可证。