SwiftyCast 1.0.3

SwiftyCast 1.0.3

Joseph Newton维护。



  • 作者:
  • Joe Newton

SwiftyCast

Codacy Badge License MIT CocoaPods Compatible Carthage Compatible Platform Linux Code Coverage

Swift Package Xcode Project Cocoapods Carthage

SwiftyCast 是一个轻量级的框架,用于在 iOS、macOS、tvOS 和 watchOS 中轻松地将对象转换为 UnsafeRawPointer 类型。

安装

SwiftyCast 通过 CocoaPodsCarthageSwift 包管理器 提供。

要通过 CocoaPods 安装,只需在 Podfile 中添加以下行:

pod 'SwiftyCast'

要通过 Carthage 安装,只需在 Cartfile 中添加以下行:

github "SomeRandomiOSDev/SwiftyCast"

要通过 Swift 包管理器安装,请将以下行添加到 Package.swift 文件的 dependencies 部分中:

.package(url: "https://github.com/SomeRandomiOSDev/SwiftyCast.git", from: "1.0.0")

用法

首先在 Swift 文件的顶部导入 SwiftyCast

import SwiftyCast

导入后,用法就像调用四个函数之一一样简单

// For casting to or from a raw pointer
unsafeBridgingCast(_:) 

// For casting to a raw pointer while incrementing the retain count of the object
unsafeBridgingRetain(_:)

// For casting from a raw pointer while decrementing the retain count of the object
unsafeBridgingRelease(_:)

// For casting to or from a raw pointer but only in the context of a callback block
withUnsafeBridgingCast(_:body:)

贡献

如果您需要特定的功能或遇到 Bug,请提交问题。如果您自行扩展 SwiftyCast 的功能或想自行修复 Bug,请提交拉取请求。

作者

Joe Newton,[email protected]

许可协议

SwiftyCast 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。