Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments