Permalink
Browse files

Use instancetype where appropriate.

  • Loading branch information...
1 parent 13d7215 commit 3ba69ffa4e55706fa952b96043f0a04f418be6b7 @pk committed Nov 1, 2013
Showing with 14 additions and 14 deletions.
  1. +4 −4 Source/Foundation/PKError.h
  2. +7 −7 Source/Foundation/PKError.m
  3. +1 −1 Source/Views/PKAlertView.h
  4. +2 −2 Source/Views/PKAlertView.m
@@ -14,10 +14,10 @@
@interface PKError : NSError
-+ (id)errorWithCode:(NSInteger)code;
-+ (id)errorWithCode:(NSInteger)code format:(NSString *)format, ...;
-+ (id)errorWithCode:(NSInteger)code description:(NSString *)description;
-+ (id)errorWithCode:(NSInteger)code userInfo:(NSDictionary *)dict;
++ (instancetype)errorWithCode:(NSInteger)code;
++ (instancetype)errorWithCode:(NSInteger)code format:(NSString *)format, ...;
++ (instancetype)errorWithCode:(NSInteger)code description:(NSString *)description;
++ (instancetype)errorWithCode:(NSInteger)code userInfo:(NSDictionary *)dict;
@end
@@ -10,11 +10,11 @@
@implementation PKError
-+ (id)errorWithCode:(NSInteger)aCode {
++ (instancetype)errorWithCode:(NSInteger)aCode {
return [self errorWithCode:aCode description:nil];
}
-+ (id)errorWithCode:(NSInteger)aCode format:(NSString *)aFormatString, ... {
++ (instancetype)errorWithCode:(NSInteger)aCode format:(NSString *)aFormatString, ... {
va_list args;
va_start(args, aFormatString);
NSString *description = [[NSString alloc] initWithFormat:aFormatString arguments:args];
@@ -23,7 +23,7 @@ + (id)errorWithCode:(NSInteger)aCode format:(NSString *)aFormatString, ... {
return [self errorWithCode:aCode description:description];
}
-+ (id)errorWithCode:(NSInteger)aCode description:(NSString *)aDescription {
++ (instancetype)errorWithCode:(NSInteger)aCode description:(NSString *)aDescription {
NSDictionary *userInfo = nil;
if (aDescription != nil) {
userInfo = [NSDictionary dictionaryWithObjectsAndKeys:aDescription,
@@ -33,13 +33,13 @@ + (id)errorWithCode:(NSInteger)aCode description:(NSString *)aDescription {
return [self errorWithCode:aCode userInfo:userInfo];
}
-+ (id)errorWithCode:(NSInteger)aCode userInfo:(NSDictionary *)aDictionary {
++ (instancetype)errorWithCode:(NSInteger)aCode userInfo:(NSDictionary *)aDictionary {
return [super errorWithDomain:nil code:aCode userInfo:aDictionary];
}
-- (id)initWithDomain:(NSString *)aDomain
- code:(NSInteger)aCode
- userInfo:(NSDictionary *)aDictionary {
+- (instancetype)initWithDomain:(NSString *)aDomain
+ code:(NSInteger)aCode
+ userInfo:(NSDictionary *)aDictionary {
return [super initWithDomain:PK_ERROR_PROJECT_DOMAIN code:aCode userInfo:aDictionary];
}
@@ -14,7 +14,7 @@
@interface PKAlertView : UIAlertView
-+ (PKAlertView *)alertWithSystemError:(NSError *)error delegate:(id)delegate;
++ (instancetype)alertWithSystemError:(NSError *)error delegate:(id)delegate;
@end
@@ -14,7 +14,7 @@ - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
-+ (PKAlertView *)alertWithSystemError:(NSError *)aError delegate:(id)aDelegate {
++ (instancetype)alertWithSystemError:(NSError *)aError delegate:(id)aDelegate {
NSString *title = NSLocalizedString(@"alert-system-error-title",nil);
NSString *messageFormat = NSLocalizedString(@"alert-system-error-message-format", nil);
NSString *message = [NSString stringWithFormat:messageFormat,
@@ -44,7 +44,7 @@ - (void)show {
#pragma mark - Notification handling
-- (void)applicationDidEnterBackground:(NSNotification*) notification {
+- (void)applicationDidEnterBackground:(NSNotification *)notification {
[self dismissWithClickedButtonIndex:[self cancelButtonIndex] animated:NO];
}

0 comments on commit 3ba69ff

Please sign in to comment.