SwiftExt 2.0.0

SwiftExt 2.0.0

测试已测试
语言 SwiftSwift
许可证 MIT
发布上次发布Jul 2015
SPM支持 SPM

WeZZard维护。



SwiftExt 2.0.0

  • WeZZard

Swift Extended Library 致力于提供原生 Swift 代替 Cocoa/CocoaTouch,并为标准 Swift 库中缺失的便利功能提供替代方案。

开始使用

手动安装

  • 下载 Swift Extended Library
  • 将 Swift Extended Library 的 Xcode 项目文件拖放到您的工作区
  • 如果是在构建应用,请在您的目标的一般页面中将 Swift Extended Library 添加到 嵌套二进制文件 字段。如果是构建框架,则将其添加到目标的一般页面中的 链接的框架和库 字段。
  • 在您的 Swift 源文件中添加 import SwiftExt
  • 享受 Swift Extended Library 的旅程

内容

新运算符

逻辑排他或运算符。

^

计算给定指数到给定 Int 值的幂

^^

新类型

SequenceDifference

指明两个序列之间的差异。

OptionSetTraversalOptions

指明如何遍历符合 RawOptionSetType 的 Swift 类型的 RawOptionSetType

新函数

检查一个序列是否包含一个对象。

func contains<S : SequenceType where S.Generator.Element : Equatable>(containerSeq: S, containedSeq: S) -> Bool

Check if a sequence of object contains an object.

func containsObject(domain: S, value: S.Generator.Element) -> Bool:

检查一个对象序列是否包含另一个对象。

containsObjects(containerSeq: S, containedSeq: S) -> Bool:

在一个对象序列中查找给定对象的索引。如果在序列中未找到给定对象,则返回nil。

findObject(domain: C, value: C.Generator.Element) -> C.Index?

检查一个序列是否与另一个序列相交,该序列的生成元素的类型符合Equatable协议。

intersects(seqA: S, seqB: S) -> Bool

检查一个集合是否与符合ExtensibleCollectionType协议的另一个集合相交,其生成元素的类型符合Equatable协议。

intersected(collectionA: C, collectionB: C) -> C

获取两个序列的差集,其中序列的元素符合Equatable协议。

func diff (from fromSequence: Seq?, to toSequence: Seq?, #differences: SequenceDifference, usingClosure changesHandler: (change: SequenceDifference, fromElement: (index: Int, element: Seq.Generator.Element)?, toElement: (index: Int, element: Seq.Generator.Element)?) -> Void)

使用自定义相等性和未更改判断处理程序获取两个序列的差异。

func diff (from fromSequence: Seq?, to toSequence: Seq?, #differences: SequenceDifference, #equalComparator: ((Seq.Generator.Element, Seq.Generator.Element) -> Bool), #unchangedComparator: ((Seq.Generator.Element, Seq.Generator.Element) -> Bool), usingClosure changesHandler: (change: SequenceDifference, fromElement: (index: Int, element: Seq.Generator.Element)?, toElement: (index: Int, element: Seq.Generator.Element)?) -> Void)

遍历一个符合RawOptionSetType的类型值中的所有已发生或未发生的选项。

enumerate(optionSet: T, withOptions options: OptionSetTraversalOptions, usingClosure handler:(optionSet: T, option: T) -> Bool ):

使用给定的RawOptionSetType符合的类型值在字典中设置一个值。

setValue(value: V, forBitmask bitmask: B, inout inDictionary dictionary: Dictionary UInt, V>)

使用给定的RawOptionSetType符合的类型值在字典中获取一个值。

根据位掩码< V, B: RawOptionSetType 其中 B.RawValue 等于 UInt >(bitmask: B, inDictionary 字典: [UInt: V])-> V?

许可证

Swift 扩展库采用 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。