Skip to content

Commit b47d5a7

Browse files
committed
Fixed warnings in the example project when compiling for 64-bit architectures. Also, update a bit of the convention in the example project to be more modern and to my taste. :P
1 parent 547ea3f commit b47d5a7

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard.xcodeproj/project.pbxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
AB0E97B9161B4BEC005498A0 /* Project object */ = {
164164
isa = PBXProject;
165165
attributes = {
166-
LastUpgradeCheck = 0450;
166+
LastUpgradeCheck = 0510;
167167
ORGANIZATIONNAME = "d--buzz";
168168
};
169169
buildConfigurationList = AB0E97BC161B4BEC005498A0 /* Build configuration list for PBXProject "LXRCVFL Example using Storyboard" */;
@@ -258,6 +258,7 @@
258258
GCC_WARN_UNINITIALIZED_AUTOS = YES;
259259
GCC_WARN_UNUSED_VARIABLE = YES;
260260
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
261+
ONLY_ACTIVE_ARCH = YES;
261262
SDKROOT = iphoneos;
262263
TARGETED_DEVICE_FAMILY = 2;
263264
};

LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/LXCollectionViewController.m

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ - (NSInteger)collectionView:(UICollectionView *)theCollectionView numberOfItemsI
7171
}
7272

7373
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
74-
PlayingCard *playingCard = [self.deck objectAtIndex:indexPath.item];
74+
PlayingCard *playingCard = self.deck[indexPath.item];
7575
PlayingCardCell *playingCardCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PlayingCardCell" forIndexPath:indexPath];
7676
playingCardCell.playingCard = playingCard;
7777

@@ -81,22 +81,24 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
8181
#pragma mark - LXReorderableCollectionViewDataSource methods
8282

8383
- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath {
84-
PlayingCard *playingCard = [self.deck objectAtIndex:fromIndexPath.item];
85-
84+
PlayingCard *playingCard = self.deck[fromIndexPath.item];
85+
8686
[self.deck removeObjectAtIndex:fromIndexPath.item];
8787
[self.deck insertObject:playingCard atIndex:toIndexPath.item];
8888
}
8989

9090
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath {
9191
#if LX_LIMITED_MOVEMENT == 1
92-
PlayingCard *playingCard = [deck objectAtIndex:indexPath.item];
92+
PlayingCard *playingCard = self.deck[indexPath.item];
9393

9494
switch (playingCard.suit) {
9595
case PlayingCardSuitSpade:
96-
case PlayingCardSuitClub:
96+
case PlayingCardSuitClub: {
9797
return YES;
98-
default:
98+
} break;
99+
default: {
99100
return NO;
101+
} break;
100102
}
101103
#else
102104
return YES;
@@ -105,15 +107,17 @@ - (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath
105107

106108
- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath {
107109
#if LX_LIMITED_MOVEMENT == 1
108-
PlayingCard *fromPlayingCard = [deck objectAtIndex:fromIndexPath.item];
109-
PlayingCard *toPlayingCard = [deck objectAtIndex:toIndexPath.item];
110+
PlayingCard *fromPlayingCard = self.deck[fromIndexPath.item];
111+
PlayingCard *toPlayingCard = self.deck[toIndexPath.item];
110112

111113
switch (toPlayingCard.suit) {
112114
case PlayingCardSuitSpade:
113-
case PlayingCardSuitClub:
115+
case PlayingCardSuitClub: {
114116
return fromPlayingCard.rank == toPlayingCard.rank;
115-
default:
117+
} break;
118+
default: {
116119
return NO;
120+
} break;
117121
}
118122
#else
119123
return YES;

LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/PlayingCard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ typedef NS_ENUM(NSInteger, PlayingCardSuit) {
1919

2020
@property (assign, nonatomic) PlayingCardSuit suit;
2121
@property (assign, nonatomic) NSInteger rank;
22-
@property (readonly, nonatomic) NSString *imageName;
22+
@property (copy, nonatomic, readonly) NSString *imageName;
2323

2424
@end

LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/PlayingCard.m

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@
99
#import "PlayingCard.h"
1010

1111
@implementation PlayingCard
12-
@synthesize suit;
13-
@synthesize rank;
1412

15-
- (NSString *)imageName
16-
{
13+
- (NSString *)imageName {
1714
switch (self.suit) {
1815
case PlayingCardSuitSpade:
19-
return [NSString stringWithFormat:@"Content/Images/cards_png/s%d.png", rank];
16+
return [NSString stringWithFormat:@"Content/Images/cards_png/s%ld.png", (long)self.rank];
2017
case PlayingCardSuitHeart:
21-
return [NSString stringWithFormat:@"Content/Images/cards_png/h%d.png", rank];
18+
return [NSString stringWithFormat:@"Content/Images/cards_png/h%ld.png", (long)self.rank];
2219
case PlayingCardSuitClub:
23-
return [NSString stringWithFormat:@"Content/Images/cards_png/c%d.png", rank];
20+
return [NSString stringWithFormat:@"Content/Images/cards_png/c%ld.png", (long)self.rank];
2421
case PlayingCardSuitDiamond:
25-
return [NSString stringWithFormat:@"Content/Images/cards_png/d%d.png", rank];
22+
return [NSString stringWithFormat:@"Content/Images/cards_png/d%ld.png", (long)self.rank];
2623
}
2724
}
2825

LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/PlayingCardCell.m

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
#import "PlayingCard.h"
1111

1212
@implementation PlayingCardCell
13-
@synthesize playingCard;
1413

15-
- (void)setPlayingCard:(PlayingCard *)thePlayingCard
16-
{
17-
playingCard = thePlayingCard;
18-
self.playingCardImageView.image = [UIImage imageNamed:playingCard.imageName];
14+
@synthesize playingCard = _playingCard;
15+
16+
- (void)setPlayingCard:(PlayingCard *)playingCard {
17+
_playingCard = playingCard;
18+
self.playingCardImageView.image = [UIImage imageNamed:_playingCard.imageName];
1919
}
2020

21-
- (void)setHighlighted:(BOOL)highlighted
22-
{
21+
- (void)setHighlighted:(BOOL)highlighted {
2322
[super setHighlighted:highlighted];
2423
self.playingCardImageView.alpha = highlighted ? 0.75f : 1.0f;
2524
}

0 commit comments

Comments
 (0)