CwlCatchExceptionSupport 2.2.0

CwlCatchExceptionSupport 2.2.0

Matt Gallagher 维护。



  • 作者:
  • Matt Gallagher

CwlCatchException

这是一个简单的 Swift 包装器,围绕 Objective-C 的 @try/@catch 语句,可以选择性地通过 NSException 子类型捕获 Objective-C 异常,如果捕获到的任何异常不是预期的子类型,则重新抛出。

查看 CwlCatchExceptionTests.swift 以获取语法。

要求

从版本 2.0.0-beta.1 开始,构建 CwlCatchException 需要 Swift 5 或更高版本,Swift Package Manager 或 CocoaPods。

对于使用较旧版本的 Swift 或其他包管理器的用途,请使用版本 1.2.0 或更旧版本:使用版本 1.2.0 或更旧版本

添加到项目中

Swift 包管理器

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

 .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0"))

或者,通过将 https://github.com/mattgallagher/CwlCatchException.git,版本 2.0.0 或更高版本,添加到 Xcode 中任何项目的 Swift 包列表中。

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。有关使用和安装说明,请访问他们的网站。要将 CwlCatchException 集成到使用 CocoaPods 的 Xcode 项目中,请在 Podfile 中指定它

pod 'CwlCatchException', '~> 2.0'

感谢

包括来自 @alexbaev、@dnkoutso 和 @ejensen 的贡献。