Bow 是一个跨平台的 Swift 类型函数式编程库。
文档
所有文档和 API 参考 发布在我们的网站上。一些指向库关键方面的链接
模块
Bow 被分割成多个模块,可以独立消费。这些模块包括:
Bow
:核心库。包含高阶类型模拟、函数操作工具、Typeclasses、数据类型、Monad Transformers 以及原语类型的实例。BowOptics
:模块,用于处理不同的光学。BowRecursionSchemes
:模块,用于处理递归方案。BowFree
:模块,用于处理 Free Monads。BowGeneric
:模块,用于处理泛型数据类型。BowEffects
:模块,用于处理 effects。BowRx
:模块,提供与 RxSwift 的集成。
还有用于测试的一些模块
BowLaws
:核心模块中类型类的定律。BowOpticsLaws
:光学的定律。BowEffectsLaws
:effect 的定律。BowGenerators
:为核心模块中的数据类型进行基于属性的测试的生成器。BowFreeGenerators
:为 BowFree 中的数据类型进行基于属性的测试的生成器。BowEffectsGenerators
:为 BowEffects 中的数据类型进行基于属性的测试的生成器。BowRxGenerators
:为 BowRx 中的数据类型进行基于属性的测试的生成器。
Bow 可通过 Swift Package Manager、CocoaPods 和 Carthage 使用。
Swift 包管理器
从 Xcode 11 开始,您可以使用 IDE 中的集成功能,利用 Swift 包管理器将依赖项引入您的项目。您只需要仓库网址:https://github.com/bow-swift/bow.git。对于早期的 Xcode 版本,创建与下面类似的 Package.swift
文件,并按需使用依赖项。
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "BowTestProject",
dependencies: [
.package(url: "https://github.com/bow-swift/bow.git", from: "{version}")
],
targets: [
.target(name: "BowTestProject",
dependencies: [
"Bow",
"BowOptics",
"BowRecursionSchemes",
"BowFree",
"BowGeneric",
"BowEffects",
"BowRx"]),
.testTarget(name: "BowTestProjectTests",
dependencies: [
// Type class laws
"BowLaws",
"BowOpticsLaws",
"BowEffectsLaws",
// Generators for PBT with SwiftCheck
"BowGenerators",
"BowFreeGenerators",
"BowEffectsGenerators",
"BowRxGenerators"])
]
)
要构建它,只需运行
$ swift build
CocoaPods
您可以将每个 Bow 模块分别作为 pod 使用。您可以在 Podfile 中按需添加以下行
pod "Bow", "~> {version}"
pod "BowOptics", "~> {version}"
pod "BowRecursionSchemes", "~> {version}"
pod "BowFree", "~> {version}"
pod "BowGeneric", "~> {version}"
pod "BowEffects", "~> {version}"
pod "BowRx", "~> {version}"
测试规则
pod "BowLaws", "~> {version}"
pod "BowOpticsLaws", "~> {version}"
pod "BowEffectsLaws", "~> {version}"
SwiftCheck 的属性基于测试生成器
pod "BowGenerators", "~> {version}"
pod "BowFreeGenerators", "~> {version}"
pod "BowEffectsGenerators", "~> {version}"
pod "BowRxGenerators", "~> {version}"
Carthage
Carthage 将下载整个 Bow 项目,但它将为每个模块分别编译单独的框架,您可分别使用。在 Cartfile 中添加此行
github "bow-swift/Bow" ~> {version}
贡献
如果您想为此库贡献力量,可以查看 问题 看一些待做的事情。
如何运行项目
在 Xcode 11(或更高版本)中打开 Bow.xcodeproj
,您就准备就绪了。Bow 使用 Swift 包管理器来处理其依赖项。
如何运行文档项目
- 进入目录
contents/Documentation
。 - 运行
pod install
以获取所有依赖。 - 打开
Documentation.xcworkspace
并运行项目。
有关更多信息,请参阅我们的贡献指南。
如何创建新版本
您可以通过运行 bundle exec fastlane release version_number:
来创建新版本。例如,bundle exec fastlane release version_number: 0.7.0
。
以下步骤将被执行
- 更新
*.podspec
文件中的version
。 - 在
CHANGELOG
文件中添加消息并创建标签。 - 部署 podspec 文件并使其公开可用。
许可
Copyright (C) 2018-2020 The Bow Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.