CwlSignal 2.2.0

CwlSignal 2.2.0

Matt Gallagher 维护。



CwlSignal 2.2.0

  • 通过
  • Matt Gallagher

CwlSignal

响应式编程的实现。有关详细信息,请参阅 Cocoa with Love 上的文章,CwlSignal,响应式编程的库

将 CwlSignal 添加到您的项目中

此项目可以通过多种不同的方式添加到您的项目中

每种方法都有标准限制,因此您需要根据您的具体情况和喜好来选择方法。

最低要求为 iOS 8 或 macOS 10.10。

手动框架包含

  1. 在项目的子目录下,运行 git clone https://github.com/mattgallagher/CwlSignal.git
  2. 将 "CwlSignal.xcodeproj" 文件从 Finder 拖到 Xcode 项目的文件树中的某个位置
  3. 将 "CwlSignal.framework" 和 "CwlUtils.framework" 从 "CwlSignal" 项目的 "Products" 文件夹拖到您想要包含此模块的任何目标的 "复制文件(框架)”构建阶段中

静态包含文件

此方法生成两个连接的文件(CwlUtils.swift, CwlSignal.swift),可以添加到其他项目(macOS 或 iOS)中,无需动态框架、库或其他设置。

  1. 通过在命令行中运行 git clone https://github.com/mattgallagher/CwlSignal.git 来获取 CwlSignal 的最新版本。
  2. 在 Xcode 中打开 CwlSignal.xcodeproj 并选择目的为 "My Mac" 的 CwlSignalConcat 构建方案(在工具栏的方案弹出菜单或菜单栏的 "Product" → "Scheme" 和 "Product" → "Destination" 菜单中选择)。
  3. 构建方案(使用 Command-B 或 "Product" → "Build")
  4. 通过在 Xcode 项目文件树中的 "Products" 文件夹上右键点击(或 Control-click),然后选择 "Show in Finder",打开 "Products" 文件夹中显示的 "Debug" 文件夹。

位于 "Concat_internal" 的文件夹中应有三个文件

  • CwlUtils_internal.swift
  • CwlSignal_internal.swift

您可以复制这些文件,并将它们像其他文件一样包含在任何自己的项目中。

还应存在一个名为 "Concat_public" 的文件夹。这个版本的软件与 "Concat_internal" 版本几乎相同,除了 "Concat_internal" 版本从文件中删除了 publicopen 标识符,而 "Concat_public" 版本将这些标识符保留在原处。这使得 "Concat_public" 版本可用于 Swift playgrounds 的 "Sources" 文件夹或其他需要从模块中导出功能的地方。

Swift 包管理器

将以下内容添加到您的 "Package.swift" 文件中的 dependencies 数组

.Package(url: "https://github.com/mattgallagher/CwlSignal.git", majorVersion: 1),

或者,如果您正在使用 swift-tools-version:4.0 包管理器,将以下内容添加到 "Package.swift" 文件中的 dependencies 数组

.package(url: "https://github.com/mattgallagher/CwlSignal.git", majorVersion: 1)

注意:尽管此 Git 仓库包含在 "Dependencies" 文件夹中的依赖项,但通过 Swift 包管理器构建将独立获取和构建这些依赖项。

CocoaPods

将以下行添加到您的 "Podfile" 中的目标

pod 'CwlSignal', :git => 'https://github.com/mattgallagher/CwlSignal.git'
pod 'CwlUtils', :git => 'https://github.com/mattgallagher/CwlUtils.git'

Carthage

将以下行添加到您的 Cartfile

git "https://github.com/mattgallagher/CwlSignal.git" "master"