Skip to content

Instantly share code, notes, and snippets.

@riley-dog
Created November 2, 2013 01:43
Show Gist options
  • Save riley-dog/7274549 to your computer and use it in GitHub Desktop.
Save riley-dog/7274549 to your computer and use it in GitHub Desktop.
States in NSArray using Objective-C new literals/syntax
//
// States.h
// CrediteraIOS
//
// Created by Buddha on 10/24/13.
// Copyright (c) 2013 Buddha Soumpholphakdy. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface States : NSObject
+(NSArray *)fullName;
+(NSArray *)shortName;
@end
//
// States.m
// CrediteraIOS
//
// Created by Buddha on 10/24/13.
// Copyright (c) 2013 Buddha Soumpholphakdy. All rights reserved.
//
#import "States.h"
@implementation States
+(NSArray *)fullName
{
return @[
@"Alabama",
@"Alaska",
@"Arizona",
@"Arkansas",
@"California",
@"Colorado",
@"Connecticut",
@"Delaware",
@"District of Columbia",
@"Florida",
@"Georgia",
@"Hawaii",
@"Idaho",
@"Illinois",
@"Indiana",
@"Iowa",
@"Kansas",
@"Kentucky",
@"Louisiana",
@"Maine",
@"Maryland",
@"Massachusetts",
@"Michigan",
@"Minnesota",
@"Mississippi",
@"Missouri",
@"Montana",
@"Nebraska",
@"Nevada",
@"New Hampshire",
@"New Jersey",
@"New Mexico",
@"New York",
@"North Carolina",
@"North Dakota",
@"Ohio",
@"Oklahoma",
@"Oregon",
@"Pennsylvania",
@"Rhode Island",
@"South Carolina",
@"South Dakota",
@"Tennessee",
@"Texas",
@"Utah",
@"Vermont",
@"Virginia",
@"Virgin Islands",
@"Washington",
@"West Virginia",
@"Wisconsin",
@"Wyoming"
];
}
+(NSArray *)shortName
{
return @[
@"AL",
@"AK",
@"AZ",
@"AR",
@"CA",
@"CO",
@"CT",
@"DE",
@"DC",
@"FL",
@"GA",
@"HI",
@"ID",
@"IL",
@"IN",
@"IA",
@"KS",
@"KY",
@"LA",
@"ME",
@"MD",
@"MA",
@"MI",
@"MN",
@"MS",
@"MO",
@"MT",
@"NE",
@"NV",
@"NH",
@"NJ",
@"NM",
@"NY",
@"NC",
@"ND",
@"OH",
@"OK",
@"OR",
@"PA",
@"RI",
@"SC",
@"SD",
@"TN",
@"TX",
@"UT",
@"VT",
@"VI",
@"VA",
@"WA",
@"WV",
@"WI",
@"WY"
];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment