Skip to content

Commit

Permalink
Add JBDeviceOwner.fullName
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Boxer committed Apr 4, 2012
1 parent 6099a51 commit 8ee7452
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions JBDeviceOwner/JBDeviceOwner.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- (id)initWithDevice:(UIDevice *)aDevice;

@property (strong, nonatomic, readonly) NSString *firstName;
@property (strong, nonatomic, readonly) NSString *fullName;
@property (strong, nonatomic, readonly) NSString *lastName;
@property (strong, nonatomic, readonly) NSString *middleName;

Expand Down
6 changes: 4 additions & 2 deletions JBDeviceOwner/JBDeviceOwner.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ @interface JBDeviceOwner ()

@property (weak, nonatomic) UIDevice *device;
@property (strong, nonatomic, readwrite) NSString *firstName;
@property (strong, nonatomic, readwrite) NSString *fullName;
@property (strong, nonatomic, readwrite) NSString *lastName;
@property (strong, nonatomic, readwrite) NSString *middleName;

Expand All @@ -23,6 +24,7 @@ @implementation JBDeviceOwner

@synthesize device;
@synthesize firstName;
@synthesize fullName;
@synthesize lastName;
@synthesize middleName;

Expand All @@ -36,8 +38,8 @@ - (id)initWithDevice:(UIDevice *)aDevice {
NSString *deviceName = self.device.name;

if ([deviceName hasSuffix:kDeviceNameSuffix]) {
NSString *name = [deviceName stringByReplacingOccurrencesOfString:kDeviceNameSuffix withString:@""];
NSArray *nameTokens = [name componentsSeparatedByString:@" "];
self.fullName = [deviceName stringByReplacingOccurrencesOfString:kDeviceNameSuffix withString:@""];
NSArray *nameTokens = [self.fullName componentsSeparatedByString:@" "];

self.firstName = [nameTokens objectAtIndex:0];

Expand Down

0 comments on commit 8ee7452

Please sign in to comment.