Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: 1.0.0
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 80 lines (58 sloc) 2.205 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//
// NSArray+SSToolkitAdditions.h
// SSToolkit
//
// Created by Sam Soffes on 8/19/09.
// Copyright 2009-2011 Sam Soffes. All rights reserved.
//

/**
Provides extensions to `NSArray` for various common tasks.
*/
@interface NSArray (SSToolkitAdditions)

///------------------------
/// @name Querying an Array
///------------------------

/**
Returns the object in the array with the lowest index value.
@return The object in the array with the lowest index value. If the array is empty, returns `nil`.
*/
- (id)firstObject;

/**
Returns the object in the array with a random index value.
@return The object in the array with a random index value. If the array is empty, returns `nil`.
*/
- (id)randomObject;


///--------------------------
/// @name Deriving New Arrays
///--------------------------

/**
Returns a new array with its elements shuffled.
@return A new array containing the receiving array's elements rearranged in a random order.
*/
- (NSArray *)shuffledArray;

/**
Returns the object returned by `mutableCopyWithZone:` where the zone is `nil`.
This differs from `mutableCopy` in that it makes any contained `NSArray` objects or `NSDictionary` objects mutable as
well. The returned dictionary follows standard memory management conventions for copied objects. You are responsible
for releasing it.
@return The object returned by the `NSMutableCopying` protocol method `mutableCopyWithZone:`, where the zone is `nil`.
*/
- (NSMutableArray *)deepMutableCopy NS_RETURNS_RETAINED;

///--------------
/// @name Hashing
///--------------

/**
Returns a string of the MD5 sum of the receiver.
@return The string of the MD5 sum of the receiver.
Internally, `NSPropertyListSerialization` is used to created the hash. Only objects that can be serialized should be
contained in the receiver when calling this method.
*/
- (NSString *)MD5Sum;

/**
Returns a string of the SHA1 sum of the receiver.
@return The string of the SHA1 sum of the receiver.
Internally, `NSPropertyListSerialization` is used to created the hash. Only objects that can be serialized should be
contained in the receiver when calling this method.
*/
- (NSString *)SHA1Sum;

@end
Something went wrong with that request. Please try again.