• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDictionary allValues not mutable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary allValues not mutable


  • Subject: Re: NSDictionary allValues not mutable
  • From: Trygve Inda <email@hidden>
  • Date: Mon, 18 Oct 2010 21:42:50 +0000
  • Thread-topic: NSDictionary allValues not mutable

> On Oct 18, 2010, at 4:22 PM, Trygve Inda wrote:
>
>> How does it derive the plural for he method name countOfWeapons from the
>> class name Weapon?
>
> It doesn’t. The property name is “weapons” in this case, the same name it
> would have had if it had been an NSArray. The only difference is that instead
> of two methods named -weapons and -setWeapons:, you have a few other methods
> with “Weapons” in their names. The only change is capitalizing the first
> letter to allow for CamelCase.
>
> Charles

So is "weapons" only defined in IB under the Array binding's model key path?

// Combatant.h:

#import <Foundation/Foundation.h>

@class Weapon;

@interface Combatant : NSObject {
    NSString *name;
    Weapon *weapon1;
    Weapon *weapon2;
    Weapon *weapon3;
    Weapon *selectedWeapon;
    int shieldRating;
}

- (unsigned int)countOfWeapons;
- (id)objectInWeaponsAtIndex:(unsigned int)index;
- (NSString *)name;
- (void)setName:(NSString *)newName;
- (Weapon *)weapon1;
- (void)setWeapon1:(Weapon *)newWeapon1;
- (Weapon *)weapon2;
- (void)setWeapon2:(Weapon *)newWeapon2;
- (Weapon *)weapon3;
- (void)setWeapon3:(Weapon *)newWeapon3;
- (Weapon *)selectedWeapon;
- (void)setSelectedWeapon:(Weapon *)aSelectedWeapon;


// Weapon.h

#import <Foundation/Foundation.h>

@interface Weapon : NSObject
{
    NSString *name;
    int damage;
}

- initWithName:(NSString *)newName damage:(int)newDamage;
- (NSString *)name;
- (void)setName:(NSString *)newName;
- (int)damage;
- (void)setDamage:(int)newDamage;



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSDictionary allValues not mutable
      • From: Charles Srstka <email@hidden>
References: 
 >Re: NSDictionary allValues not mutable (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: NSDictionary allValues not mutable
  • Next by Date: Re: NSDictionary allValues not mutable
  • Previous by thread: Re: NSDictionary allValues not mutable
  • Next by thread: Re: NSDictionary allValues not mutable
  • Index(es):
    • Date
    • Thread