diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2017-01-04 14:48:31 -0500 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2017-01-04 14:48:31 -0500 |
commit | 1d3fe8202fcb9895403199c7ef7060422fd8c6f1 (patch) | |
tree | c87d6b7cdf02ec30977e2d91e1bfe5bc0e3ac3bf | |
parent | 1742c6102773b12a664b38161467faa6fb326ed4 (diff) | |
download | sdl_ios-1d3fe8202fcb9895403199c7ef7060422fd8c6f1.tar.gz |
Added nullability annotations to Utility classes.
-rw-r--r-- | SmartDeviceLink/SDLConsoleController.h | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugTool.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugToolConsole.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLHexUtility.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLHexUtility.m | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNames.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNames.m | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLObjectWithPriority.h | 9 | ||||
-rw-r--r-- | SmartDeviceLink/SDLObjectWithPriority.m | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPrioritizedObjectCollection.h | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPrioritizedObjectCollection.m | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLTimer.h | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLTimer.m | 5 |
13 files changed, 59 insertions, 12 deletions
diff --git a/SmartDeviceLink/SDLConsoleController.h b/SmartDeviceLink/SDLConsoleController.h index 1376a2b5f..41807164c 100644 --- a/SmartDeviceLink/SDLConsoleController.h +++ b/SmartDeviceLink/SDLConsoleController.h @@ -6,6 +6,7 @@ #import "SDLDebugTool.h" +NS_ASSUME_NONNULL_BEGIN @interface SDLConsoleController : UITableViewController <SDLDebugToolConsole> { NSMutableArray<NSDictionary<NSString *, id>*> *messageList; @@ -19,3 +20,5 @@ @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLDebugTool.h b/SmartDeviceLink/SDLDebugTool.h index 98ddc6c77..9cb588edd 100644 --- a/SmartDeviceLink/SDLDebugTool.h +++ b/SmartDeviceLink/SDLDebugTool.h @@ -25,6 +25,8 @@ typedef NS_ENUM(UInt8, SDLDebugOutput) { }; +NS_ASSUME_NONNULL_BEGIN + @interface SDLDebugTool : NSObject { } @@ -49,3 +51,5 @@ typedef NS_ENUM(UInt8, SDLDebugOutput) { @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLDebugToolConsole.h b/SmartDeviceLink/SDLDebugToolConsole.h index 75d541e16..941061851 100644 --- a/SmartDeviceLink/SDLDebugToolConsole.h +++ b/SmartDeviceLink/SDLDebugToolConsole.h @@ -4,9 +4,13 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @protocol SDLDebugToolConsole <NSObject> @required - (void)logInfo:(NSString *)info; @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLHexUtility.h b/SmartDeviceLink/SDLHexUtility.h index 7b639a7af..95b564b57 100644 --- a/SmartDeviceLink/SDLHexUtility.h +++ b/SmartDeviceLink/SDLHexUtility.h @@ -5,9 +5,13 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @interface SDLHexUtility : NSObject + (NSString *)getHexString:(UInt8 *)bytes length:(NSUInteger)length; + (NSString *)getHexString:(NSData *)data; @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLHexUtility.m b/SmartDeviceLink/SDLHexUtility.m index 0787d804a..b103322ed 100644 --- a/SmartDeviceLink/SDLHexUtility.m +++ b/SmartDeviceLink/SDLHexUtility.m @@ -7,6 +7,8 @@ @implementation SDLHexUtility +NS_ASSUME_NONNULL_BEGIN + // Using this function as a fail-safe, because we know this is successful. + (NSString *)getHexString:(UInt8 *)bytes length:(NSUInteger)length { NSMutableString *ret = [NSMutableString stringWithCapacity:(length * 2)]; @@ -58,3 +60,5 @@ NSString *getHexString(NSData *data) { @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index 47a9522be..432e26bbb 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -4,6 +4,8 @@ #import <Foundation/Foundation.h> #import "SDLMacros.h" +NS_ASSUME_NONNULL_BEGIN + typedef NSString* SDLName SDL_SWIFT_ENUM; extern SDLName const SDLNameAccelerationPedalPosition; @@ -440,3 +442,5 @@ extern SDLName const SDLNameWiperStatus; extern SDLName const SDLNameX; extern SDLName const SDLNameY; extern SDLName const SDLNameYear; + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLNames.m b/SmartDeviceLink/SDLNames.m index 6295598b1..cd09be4df 100644 --- a/SmartDeviceLink/SDLNames.m +++ b/SmartDeviceLink/SDLNames.m @@ -3,6 +3,8 @@ #import "SDLNames.h" +NS_ASSUME_NONNULL_BEGIN + SDLName const SDLNameAccelerationPedalPosition = @"accPedalPosition"; SDLName const SDLNameActual = @"actual"; SDLName const SDLNameAddCommand = @"AddCommand"; @@ -437,3 +439,5 @@ SDLName const SDLNameWiperStatus = @"wiperStatus"; SDLName const SDLNameX = @"x"; SDLName const SDLNameY = @"y"; SDLName const SDLNameYear = @"year"; + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLObjectWithPriority.h b/SmartDeviceLink/SDLObjectWithPriority.h index 334139d5f..b02041a57 100644 --- a/SmartDeviceLink/SDLObjectWithPriority.h +++ b/SmartDeviceLink/SDLObjectWithPriority.h @@ -5,14 +5,17 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN @interface SDLObjectWithPriority : NSObject -@property (strong) id object; +@property (nullable, strong) id object; @property (assign) NSInteger priority; -- (instancetype)initWithObject:(id)object priority:(NSInteger)priority NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject:(nullable id)object priority:(NSInteger)priority NS_DESIGNATED_INITIALIZER; -+ (instancetype)objectWithObject:(id)object priority:(NSInteger)priority; ++ (instancetype)objectWithObject:(nullable id)object priority:(NSInteger)priority; @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLObjectWithPriority.m b/SmartDeviceLink/SDLObjectWithPriority.m index 4dd72091e..6c8d72878 100644 --- a/SmartDeviceLink/SDLObjectWithPriority.m +++ b/SmartDeviceLink/SDLObjectWithPriority.m @@ -5,10 +5,11 @@ #import "SDLObjectWithPriority.h" +NS_ASSUME_NONNULL_BEGIN @implementation SDLObjectWithPriority -- (instancetype)initWithObject:(id)object priority:(NSInteger)priority { +- (instancetype)initWithObject:(nullable id)object priority:(NSInteger)priority { self = [super init]; if (self == nil) { return nil; @@ -24,8 +25,10 @@ return [self initWithObject:nil priority:NSIntegerMax]; } -+ (instancetype)objectWithObject:(id)object priority:(NSInteger)priority { ++ (instancetype)objectWithObject:(nullable id)object priority:(NSInteger)priority { return [[self alloc] initWithObject:object priority:priority]; } @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLPrioritizedObjectCollection.h b/SmartDeviceLink/SDLPrioritizedObjectCollection.h index 8cf90c805..993f7d903 100644 --- a/SmartDeviceLink/SDLPrioritizedObjectCollection.h +++ b/SmartDeviceLink/SDLPrioritizedObjectCollection.h @@ -5,6 +5,8 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @interface SDLPrioritizedObjectCollection : NSObject /** @@ -15,13 +17,15 @@ * @param object The object to be added to the priority collection * @param priority The priority to use when determining the location of the object in the collection. A lower number is considered a higher priority */ -- (void)addObject:(id)object withPriority:(NSInteger)priority; +- (void)addObject:(nullable id)object withPriority:(NSInteger)priority; /** * Retreive the highest priority object from the collection. This also removes the object. * * @return The highest priority object retrieved from the collection. */ -- (id)nextObject; +- (nullable id)nextObject; @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLPrioritizedObjectCollection.m b/SmartDeviceLink/SDLPrioritizedObjectCollection.m index c1b5b15b7..398ca4057 100644 --- a/SmartDeviceLink/SDLPrioritizedObjectCollection.m +++ b/SmartDeviceLink/SDLPrioritizedObjectCollection.m @@ -6,6 +6,7 @@ #import "SDLPrioritizedObjectCollection.h" #import "SDLObjectWithPriority.h" +NS_ASSUME_NONNULL_BEGIN @interface SDLPrioritizedObjectCollection () { NSMutableArray<id> *privateArray; @@ -23,7 +24,7 @@ return self; } -- (void)addObject:(id)object withPriority:(NSInteger)priority { +- (void)addObject:(nullable id)object withPriority:(NSInteger)priority { if (object == nil || [[NSNull null] isEqual:object]) { return; } @@ -49,7 +50,7 @@ } } -- (instancetype)nextObject { +- (nullable instancetype)nextObject { if (privateArray.count == 0) { return nil; } @@ -64,3 +65,5 @@ } @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLTimer.h b/SmartDeviceLink/SDLTimer.h index f9f7be3d9..2bfde8325 100644 --- a/SmartDeviceLink/SDLTimer.h +++ b/SmartDeviceLink/SDLTimer.h @@ -4,10 +4,12 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @interface SDLTimer : NSObject -@property (nonatomic, copy) void (^elapsedBlock)(void); -@property (nonatomic, copy) void (^canceledBlock)(void); +@property (nullable, nonatomic, copy) void (^elapsedBlock)(void); +@property (nullable, nonatomic, copy) void (^canceledBlock)(void); @property (assign) float duration; - (instancetype)init; @@ -17,3 +19,5 @@ - (void)cancel; @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLTimer.m b/SmartDeviceLink/SDLTimer.m index 84ee6e24b..2e0ae0a09 100644 --- a/SmartDeviceLink/SDLTimer.m +++ b/SmartDeviceLink/SDLTimer.m @@ -4,10 +4,11 @@ #import "SDLTimer.h" +NS_ASSUME_NONNULL_BEGIN @interface SDLTimer () -@property (strong) NSTimer *timer; +@property (nullable, strong) NSTimer *timer; @property (assign) BOOL timerRunning; @property (nonatomic) BOOL repeat; @end @@ -77,3 +78,5 @@ } @end + +NS_ASSUME_NONNULL_END |