Skip to content

Commit b39ca47

Browse files
須藤将史須藤将史
authored andcommitted
Implemented usage of instancetype
1 parent 33b924d commit b39ca47

9 files changed

+28
-28
lines changed

StudyplusSDK/SPLStopwatch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ @interface SPLStopwatch()
3535

3636
@implementation SPLStopwatch
3737

38-
-(id)init
38+
-(instancetype)init
3939
{
4040
if (self = [super init]) {
4141
self.elapsedSeconds = 0;

StudyplusSDK/SPLStudyplus.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ NS_ASSUME_NONNULL_BEGIN
108108
@return SPLStudyplus object. <br>
109109
SPLStudyplusオブジェクト。
110110
*/
111-
+ (SPLStudyplus*)studyplusWithConsumerKey:(NSString*)consumerKey
112-
andConsumerSecret:(NSString*)consumerSecret;
111+
+ (instancetype)studyplusWithConsumerKey:(NSString*)consumerKey
112+
andConsumerSecret:(NSString*)consumerSecret;
113113

114114
/**
115115
Opens the auth screen by invoking the Studyplus application.

StudyplusSDK/SPLStudyplus.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ @interface SPLStudyplus()
4242

4343
@implementation SPLStudyplus
4444

45-
+ (SPLStudyplus*)studyplusWithConsumerKey:(NSString*)consumerKey
46-
andConsumerSecret:(NSString*)consumerSecret
45+
+ (instancetype)studyplusWithConsumerKey:(NSString*)consumerKey
46+
andConsumerSecret:(NSString*)consumerSecret
4747
{
4848
return [[SPLStudyplus alloc] __initWithConsumerKey:consumerKey
4949
andConsumerSecret:consumerSecret];
5050
}
5151

52-
- (id)__initWithConsumerKey:(NSString*)consumerKey
53-
andConsumerSecret:(NSString*)consumerSecret
52+
- (instancetype)__initWithConsumerKey:(NSString*)consumerKey
53+
andConsumerSecret:(NSString*)consumerSecret
5454
{
5555

5656
if (self = [super init]) {

StudyplusSDK/SPLStudyplusAPIRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
2626

2727
@interface SPLStudyplusAPIRequest : NSObject
2828

29-
+ (SPLStudyplusAPIRequest*)newRequestWithAccessToken:(NSString*)accessToken
30-
options:(NSDictionary*)options;
29+
+ (instancetype)newRequestWithAccessToken:(NSString*)accessToken
30+
options:(NSDictionary*)options;
3131

3232
- (void)postRequestWithPath:(NSString *)path
3333
requestParameter:(NSDictionary *)requestParameter

StudyplusSDK/SPLStudyplusAPIRequest.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ @interface SPLStudyplusAPIRequest()
3535

3636
@implementation SPLStudyplusAPIRequest
3737

38-
- (id)init
38+
- (instancetype)init
3939
{
4040
if (self = [super init]) {
4141
_accessToken = nil;
4242
}
4343
return self;
4444
}
4545

46-
+ (SPLStudyplusAPIRequest*)newRequestWithAccessToken:(NSString*)accessToken
47-
options:(NSDictionary*)options
46+
+ (instancetype)newRequestWithAccessToken:(NSString*)accessToken
47+
options:(NSDictionary*)options
4848
{
4949
return [[SPLStudyplusAPIRequest alloc] initWithAccessToken:accessToken
5050
options:options];
5151
}
5252

53-
- (id)initWithAccessToken:(NSString*)accessToken
54-
options:(NSDictionary*)options
53+
- (instancetype)initWithAccessToken:(NSString*)accessToken
54+
options:(NSDictionary*)options
5555
{
5656
if (self = [super init]) {
5757
_accessToken = accessToken;

StudyplusSDK/SPLStudyplusRecord.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
6767
6868
@result StudyplusRecord object.
6969
*/
70-
+ (SPLStudyplusRecord*)recordWithDuration:(NSTimeInterval)duration;
70+
+ (instancetype)recordWithDuration:(NSTimeInterval)duration;
7171

7272
/**
7373
Creates and returns StudyplusRecord object that has number of seconds and other attributes.
@@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
8989
9090
@result StudyplusRecord object.
9191
*/
92-
+ (SPLStudyplusRecord*)recordWithDuration:(NSTimeInterval)duration options:(NSDictionary* _Nullable)options;
92+
+ (instancetype)recordWithDuration:(NSTimeInterval)duration options:(NSDictionary* _Nullable)options;
9393

9494
/**
9595
@result Returns the parameters of the study record for posting API

StudyplusSDK/SPLStudyplusRecord.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ - (id)getKey:(NSString*)key orElse:(id)elseValue;
3333

3434
@implementation SPLStudyplusRecord
3535

36-
+ (SPLStudyplusRecord*)recordWithDuration:(NSTimeInterval)duration
36+
+ (instancetype)recordWithDuration:(NSTimeInterval)duration
3737
{
3838
return [self recordWithDuration:duration options:@{}];
3939
}
4040

41-
+ (SPLStudyplusRecord*)recordWithDuration: (NSTimeInterval)duration options:(NSDictionary*)options
41+
+ (instancetype)recordWithDuration: (NSTimeInterval)duration options:(NSDictionary*)options
4242
{
4343
return [[[self class] alloc] initWithDuration:duration options:options];
4444
}
@@ -52,7 +52,7 @@ - (id)getKey:(NSString *)key from:(NSDictionary *)dict orElse:(id)elseValue
5252
return value;
5353
}
5454

55-
- (id)initWithDuration:(NSTimeInterval)duration options:(NSDictionary*)options
55+
- (instancetype)initWithDuration:(NSTimeInterval)duration options:(NSDictionary*)options
5656
{
5757
if (self = [super init]) {
5858
_duration = duration;

StudyplusSDK/SPLStudyplusRecordAmount.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
3737
@param amount 学習量。
3838
@result SPLStudyplusRecordAmount* 生成したAmountオブジェクトです。
3939
*/
40-
+ (SPLStudyplusRecordAmount*)amount:(NSUInteger)amount;
40+
+ (instancetype)amount:(NSUInteger)amount;
4141

4242
/**
4343
Creates and returns the Amount object with a range of learning amount.<br>
@@ -47,14 +47,14 @@ NS_ASSUME_NONNULL_BEGIN
4747
@param to 学習量の終点。
4848
@result SPLStudyplusRecordAmount* 生成したAmountオブジェクトです。
4949
*/
50-
+ (SPLStudyplusRecordAmount*)amountAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to;
50+
+ (instancetype)amountAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to;
5151

5252
/**
5353
Creates and returns the Amount object that has no learning amount.<br>
5454
学習量を持たないAmountオブジェクトを生成して返します。
5555
@result SPLStudyplusRecordAmount* 生成したAmountオブジェクトです。
5656
*/
57-
+ (SPLStudyplusRecordAmount*)amountAsNone;
57+
+ (instancetype)amountAsNone;
5858

5959
/**
6060
@result Returns the parameters of the study record for posting API

StudyplusSDK/SPLStudyplusRecordAmount.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ @interface SPLStudyplusRecordAmount()
2828

2929
@implementation SPLStudyplusRecordAmount
3030

31-
+ (SPLStudyplusRecordAmount*)amount:(NSUInteger)amount
31+
+ (instancetype)amount:(NSUInteger)amount
3232
{
3333
return [[[self class] alloc] initAsAmount:amount];
3434
}
3535

36-
- (id)initAsAmount:(NSUInteger)amount
36+
- (instancetype)initAsAmount:(NSUInteger)amount
3737
{
3838
if (self = [super init]) {
3939
_requestParameter = @{
@@ -43,12 +43,12 @@ - (id)initAsAmount:(NSUInteger)amount
4343
return self;
4444
}
4545

46-
+ (SPLStudyplusRecordAmount*)amountAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to
46+
+ (instancetype)amountAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to
4747
{
4848
return [[[self class] alloc] initAsRangeWithFrom:from to:to];
4949
}
5050

51-
- (id)initAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to
51+
- (instancetype)initAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to
5252
{
5353
if (self = [super init]) {
5454
_requestParameter = @{
@@ -59,12 +59,12 @@ - (id)initAsRangeWithFrom:(NSUInteger)from to:(NSUInteger)to
5959
return self;
6060
}
6161

62-
+ (SPLStudyplusRecordAmount*)amountAsNone
62+
+ (instancetype)amountAsNone
6363
{
6464
return [[[self class] alloc] initAsNone];
6565
}
6666

67-
- (id)initAsNone
67+
- (instancetype)initAsNone
6868
{
6969
if (self = [super init]) {
7070
_requestParameter = @{};

0 commit comments

Comments
 (0)