EasySequence is a powerful fundamental library to process sequence type, such as array, set, dictionary. Each type of object which conforms to NSFastEnumeration protocol can be initialzed to an EZSequence instance, then you can operate with it. Finally, you can transfer it back to the original type.
Requirements
iOS 8.0 or later.
Installation
EasySequence is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'EasySequence'
To run the example project, clone the repo, and run pod install from the Example directory first.
Features
Creating
can be initialized from any object which conforms to NSFastEnumeration protocol.
Enumerating
enumerate using forEach:
enumerate using forEachWithIndex:
enumerate using fast enumeration
enumerate using NSEnumerator
Operations
map
flatten map
filter
select
reject
take
skip
any
zip
reduce
group by
first object
first object where
first index where
Transfer
An object which conforms to EZSTransfer protocol can get an instance which transfer from EZSequence.
Thread-Safety Type
We provides thread-safety types as below:
EZSArray
EZSWeakArray
EZSOrderedSet
EZSWeakOrderedSet
EZSQueue
Weak Container
EZSWeakArray and EZSWeakOrderedSet form weak reference to their’s items.
Example
Create a sequence
A sequence, represented by the EZSequence type, is a particular order in which ralated objects, or objects follow each other. For example, a NSArray or a NSSet is sequence ather than EZSequence.
An EZSequence can be initialized from any object which conforms to NSFastEnumeration protocol.
EasySequence is a powerful fundamental library to process sequence type, such as array, set, dictionary. Each type of object which conforms to NSFastEnumeration protocol can be initialzed to an EZSequence instance, then you can operate with it. Finally, you can transfer it back to the original type.
Requirements
iOS 8.0 or later.
Installation
EasySequence is available through CocoaPods. To install it, simply add the following line to your Podfile:
To run the example project, clone the repo, and run
pod installfrom the Example directory first.Features
Creating
NSFastEnumerationprotocol.Enumerating
forEach:forEachWithIndex:Operations
Transfer
EZSTransferprotocol can get an instance which transfer fromEZSequence.Thread-Safety Type
We provides thread-safety types as below:
Weak Container
EZSWeakArrayandEZSWeakOrderedSetform weak reference to their’s items.Example
Create a sequence
A sequence, represented by the
EZSequencetype, is a particular order in which ralated objects, or objects follow each other. For example, aNSArrayor aNSSetis sequence ather thanEZSequence.An
EZSequencecan be initialized from any object which conforms toNSFastEnumerationprotocol.Enumerating
Operations
For more examples and help, see also our unit test and API comments.
Transfer Protocol
An object which conforms to
EZSTransferprotocol can get an instance which transfer fromEZSequence.Author
William Zang, chengwei.zang.1985@gmail.com
姜沂, nero_jy@qq.com
Qin Hong, qinhong@face2d.com
SketchK, zhangsiqi1988@gmail.com
License
EasySequence is available under the MIT license. See the LICENSE file for more info.