Open Source Library For Creating Grouped Arrays In Swift And Objective-C

A couple of months ago I mentioned an excellent open source project for creating advanced interactive animations from Intuit called INTUAnimationEngine.

Here’s another interesting submitted open source project from Intuit for creating grouped arrays allowing you to avoid complicated nested arrays and arrays combined other data structures called INTUGroupedArray.  INTUGroupedArray is available in both Swift and Objective-C.

As the readme states:

INTUGroupedArray is an Objective-C data structure that takes the common one-dimensional array to the next dimension. The grouped array is designed with a familiar API to fit right in alongside Foundation collections like NSArray, with fully-featured immutable and mutable variants. A thin bridge brings the grouped array to Swift as native classes, where it harnesses the power, safety, and flexibility of generics, optionals, subscripts, literals, tuples, and much more.

Here are a few code examples from the readme showing how to create an INTUGroupedArray, create a mutable version of the array, and replace an object within the array:

let groupedArray: GroupedArray<NSString, NSString> = ["Section 1", ["Object A", "Object B"],
"Section 2", ["Object C"],
"Section 3", ["Object D", "Object E", "Object F"]]

var mutableGroupedArray = groupedArray.mutableCopy() // the type of mutableGroupedArray is inferred to be: MutableGroupedArray<NSString, NSString>

mutableGroupedArray[2, 0] = "Another Object"

Swift and Objective-C sample projects are included.

 

You can find GroupedArray on Github here.

A nice Objective-C and Swift addition.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source Library For Creating Grouped Arrays In Swift And Objective-C

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *