Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

NSArray

pNre edited this page Jun 18, 2014 · 2 revisions

Contents

#Instance methods

cast

  • cast <OutType> () -> OutType[]

Converts self (NSArray) to a swift array of OutType objects (OutType[]).

Example

Pay attention: Any NSNumber is always converted to Bool, Int, Float, ...

let array = ["A", 10, "B", "C", false]
array.cast() as Int[]
// → [10, 0]

flatten

  • each (call: (T) -> ())

Flattens the nested self (NSArray) to a swift array of OutType objects (OutType[]).

Example

let array = [5, [6, ["A", 7]], 8]
array.flatten() as Int[]
// → [5, 6, 7, 8]
Clone this wiki locally