Skip to content

Commit

Permalink
Added GCM_FINAL Macro to Prevent Subclassing
Browse files Browse the repository at this point in the history
GameCenterManager classes marked with the GCM_FINAL Macro cannot be
subclassed.
  • Loading branch information
Sam Spencer committed Dec 13, 2015
1 parent 04b143f commit ad192af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions GC Manager/GCMConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#ifndef GCMConstants_h
#define GCMConstants_h

#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
#define GCM_FINAL __attribute__((objc_subclassing_restricted))
#else
#define GCM_FINAL
#endif


/// Leaderboard sort order. Use this value when submitting new leaderboard scores. This value should match the value set in iTunes Connect for the speicifed leaderboard.
typedef enum GameCenterSortOrder {
/// Scores are sorted highest to lowest. Higher scores are on the top of the leaderboard
Expand Down
2 changes: 1 addition & 1 deletion GC Manager/GCMMultiplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@protocol GameCenterMultiplayerManagerDelegate;

@interface GCMMultiplayer : NSObject <GKMatchmakerViewControllerDelegate, GKMatchDelegate, GKLocalPlayerListener>
GCM_FINAL @interface GCMMultiplayer : NSObject <GKMatchmakerViewControllerDelegate, GKMatchDelegate, GKLocalPlayerListener>

/// Returns the default instance of the multiplayer manager
+ (GCMMultiplayer *)defaultMultiplayerManager;
Expand Down
2 changes: 1 addition & 1 deletion GC Manager/GameCenterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/// GameCenter Manager helps to manage Game Center in iOS and Mac apps. Report and keep track of high scores, achievements, and challenges for different players. GameCenter Manager also takes care of the heavy lifting - checking internet availability, saving data when offline and uploading it when online, etc.
@class GameCenterManager;
@protocol GameCenterManagerDelegate;
@interface GameCenterManager : NSObject <GKGameCenterControllerDelegate>
GCM_FINAL @interface GameCenterManager : NSObject <GKGameCenterControllerDelegate>


/// Returns the shared instance of GameCenterManager.
Expand Down

0 comments on commit ad192af

Please sign in to comment.