Is this a valid way to initalize an NSArray with float objects?
NSArray *fatArray = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:6.9]
If you're going to be creating a lot of these arrays with exactly the same number of elements, you could define a FloatArrayFactory class that implements something like:
+ (NSArray *) arrayWithFloat: (float)f;
+ (NSArray *) arrayWithFloat: (float)f1 and: (float)f2;
+ (NSArray *) arrayWithFloat: (float)f1 and: (float)f2 and: (float)f3;
+ (NSArray *) arrayWithFloat: (float)f1 and: (float)f2 and: (float)f3 and: (float)f4;
And if that's too verbose, you could go for the terse and funky look of unnamed parameters:
+ (NSArray *) arr: (float)f1 : (float)f2 : (float)f3;
which you can call like this:
NSArray *a = [Factory arr: 1.0 :2.0 :3.0 :4.0];