How to create object in IOS similar to JAVASCRIPT -
how can create object similar in javascript?
var writers = { publicaccess: false, ids: [] };
please ?
use nsdictionary
.
the quickest way create following:
nsdictionary *dict = @{ @"publicaccess": @no, @"ids": @[@"id1", @"id2"] };
with full objective-c syntax, , if don't want static dictionary, go:
nsmutabledictionary *dict = [[nsmutabledictionary alloc] init]; [dict setobject:@no forkey:@"publicaccess"]; [dict setobject:[[nsmutablearray alloc] initwithobjects:@"id1", @"id2", nil] forkey:@"ids"];
Comments
Post a Comment