Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
Add Nullability Annotations
Browse files Browse the repository at this point in the history
* Annotate every .h file with NS_ASSUME_NONNULL_BEGIN/_END
* Annotate methods and properties as nullable to fix warnings.
  • Loading branch information
aaronbrethorst committed Nov 1, 2015
1 parent 4251730 commit 65a5964
Show file tree
Hide file tree
Showing 136 changed files with 584 additions and 170 deletions.
4 changes: 4 additions & 0 deletions OBAApplicationDelegate.h
Expand Up @@ -19,6 +19,8 @@
#import "GAI.h"
#import "OBAApplication.h"

NS_ASSUME_NONNULL_BEGIN

@class OBASearchResultsMapViewController;
@class OBARecentStopsViewController;
@class OBABookmarksViewController;
Expand Down Expand Up @@ -64,3 +66,5 @@
-(BOOL) readSetRegionAutomatically;
-(void) setOBARegion:(OBARegionV2*) region;
@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion categories/MKMapView+oba_Additions.h
Expand Up @@ -10,6 +10,10 @@

#import <MapKit/MapKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface MKMapView (oba_Additions)
- (void)oba_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated;
@end
@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion categories/UINavigationController+oba_Additions.h
Expand Up @@ -8,6 +8,10 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UINavigationController (oba_Additions)
-(void) replaceViewController:(UIViewController*)viewController animated:(BOOL)animated;
- (void)replaceViewController:(UIViewController*)viewController animated:(BOOL)animated;
@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions categories/UITableViewCell+oba_Additions.h
Expand Up @@ -10,6 +10,8 @@

@class OBAServiceAlertsModel;

NS_ASSUME_NONNULL_BEGIN

@interface UITableViewCell (oba_Additions)
+ (UITableViewCell*)getOrCreateCellForTableView:(UITableView*)tableView cellId:(NSString*)cellId;
+ (UITableViewCell*)getOrCreateCellForTableView:(UITableView*)tableView;
Expand All @@ -21,3 +23,5 @@
+ (UITableViewCell*) tableViewCellForUnreadServiceAlerts:(OBAServiceAlertsModel*)serviceAlerts tableView:(UITableView*)tableView;
+ (UITableViewCell*) tableViewCellForServiceAlerts:(OBAServiceAlertsModel*)serviceAlerts tableView:(UITableView*)tableView;
@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions categories/UITableViewController+oba_Additions.h
Expand Up @@ -8,6 +8,10 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UITableViewController (oba_Additions)
- (void) hideEmptySeparators;
@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions categories/UIViewController+OBAAnalytics.h
Expand Up @@ -8,6 +8,10 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (OBAAnalytics)

@end

NS_ASSUME_NONNULL_END
6 changes: 3 additions & 3 deletions controls/alerts/OBANetworkErrorAlertViewDelegate.h
Expand Up @@ -17,12 +17,12 @@

#import "OBAApplicationDelegate.h"

NS_ASSUME_NONNULL_BEGIN

@interface OBANetworkErrorAlertViewDelegate : NSObject <UIAlertViewDelegate> {
OBAApplicationDelegate * _context;
}

- (id) initWithContext:(OBAApplicationDelegate*)context;


@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions controls/containers/OBAScopeView.h
Expand Up @@ -8,7 +8,11 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface OBAScopeView : UIView
@property BOOL drawsTopBorder;
@property BOOL drawsBottomBorder;
@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions controls/labels/OBAShadowLabel.h
Expand Up @@ -9,6 +9,10 @@
#import <UIKit/UIKit.h>
#import "MarqueeLabel.h"

NS_ASSUME_NONNULL_BEGIN

@interface OBAShadowLabel : MarqueeLabel

@end

NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions controls/progress/OBAModalActivityIndicator.h
@@ -1,3 +1,6 @@

NS_ASSUME_NONNULL_BEGIN

@interface OBAModalActivityIndicator : NSObject {
UIView * _modalView;
UIActivityIndicatorView * _activityIndicatorView;
Expand All @@ -7,3 +10,5 @@
- (void) hide;

@end

NS_ASSUME_NONNULL_END
16 changes: 8 additions & 8 deletions controls/progress/OBAProgressIndicatorImpl.h
Expand Up @@ -14,22 +14,22 @@
* limitations under the License.
*/

//#import <Foundation/Foundation.h>
#import "OBAProgressIndicatorSource.h"

NS_ASSUME_NONNULL_BEGIN

@interface OBAProgressIndicatorImpl : NSObject <OBAProgressIndicatorSource> {
NSString * _message;
BOOL _inProgress;
float _progress;

}
@property(strong,readonly) NSString * message;
@property(readonly) BOOL inProgress;
@property(readonly) float progress;

@property (strong,readonly) NSString * message;
@property (readonly) BOOL inProgress;
@property (readonly) float progress;

- (void) setMessage:(NSString*)message inProgress:(BOOL)inProgress progress:(float)progress;
- (void) setInProgress:(BOOL)inProgress progress:(float)progress;
- (void)setMessage:(nullable NSString*)message inProgress:(BOOL)inProgress progress:(float)progress;
- (void)setInProgress:(BOOL)inProgress progress:(float)progress;

@end

NS_ASSUME_NONNULL_END
9 changes: 6 additions & 3 deletions controls/progress/OBAProgressIndicatorView.h
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

NS_ASSUME_NONNULL_BEGIN

@interface OBAProgressIndicatorView : UIView {
UILabel * _label;
Expand All @@ -22,9 +23,11 @@
UIProgressView * _progressView;
}

- (id) initWithFrame:(CGRect)frame;
- (id)initWithFrame:(CGRect)frame;

- (void) setMessage:(NSString*)message inProgress:(BOOL)inProgress progress:(CGFloat)progress;
- (void) setInProgress:(BOOL)inProgress progress:(CGFloat)progress;
- (void)setMessage:(nullable NSString*)message inProgress:(BOOL)inProgress progress:(CGFloat)progress;
- (void)setInProgress:(BOOL)inProgress progress:(CGFloat)progress;

@end

NS_ASSUME_NONNULL_END
5 changes: 4 additions & 1 deletion controls/table_cells/OBAArrivalEntryTableViewCell.h
Expand Up @@ -14,13 +14,14 @@
* limitations under the License.
*/


typedef NS_ENUM(NSInteger, OBAArrivalEntryTableViewCellAlertStyle) {
OBAArrivalEntryTableViewCellAlertStyleNone,
OBAArrivalEntryTableViewCellAlertStyleInactive,
OBAArrivalEntryTableViewCellAlertStyleActive
};

NS_ASSUME_NONNULL_BEGIN

@interface OBAArrivalEntryTableViewCell : UITableViewCell {
OBAArrivalEntryTableViewCellAlertStyle _alertStyle;
NSTimer * _transitionTimer;
Expand All @@ -40,3 +41,5 @@ typedef NS_ENUM(NSInteger, OBAArrivalEntryTableViewCellAlertStyle) {
+ (OBAArrivalEntryTableViewCell*) getOrCreateCellForTableView:(UITableView*)tableView;

@end

NS_ASSUME_NONNULL_END
3 changes: 3 additions & 0 deletions controls/table_cells/OBAArrivalEntryTableViewCellFactory.h
@@ -1,6 +1,7 @@
#import "OBAApplicationDelegate.h"
#import "OBAArrivalEntryTableViewCell.h"

NS_ASSUME_NONNULL_BEGIN

@interface OBAArrivalEntryTableViewCellFactory : NSObject {
OBAApplicationDelegate * _appDelegate;
Expand All @@ -15,3 +16,5 @@
@property (nonatomic) BOOL showServiceAlerts;

@end

NS_ASSUME_NONNULL_END
6 changes: 6 additions & 0 deletions controls/table_cells/OBALabelAndSwitchTableViewCell.h
@@ -1,3 +1,7 @@
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface OBALabelAndSwitchTableViewCell : UITableViewCell

@property (nonatomic,strong) IBOutlet UILabel * label;
Expand All @@ -6,3 +10,5 @@
+ (OBALabelAndSwitchTableViewCell*) getOrCreateCellForTableView:(UITableView*)tableView;

@end

NS_ASSUME_NONNULL_END
7 changes: 6 additions & 1 deletion controls/table_cells/OBALabelAndTextFieldTableViewCell.h
@@ -1,8 +1,13 @@

NS_ASSUME_NONNULL_BEGIN

@interface OBALabelAndTextFieldTableViewCell : UITableViewCell

@property (nonatomic,strong) IBOutlet UILabel * label;
@property (nonatomic,strong) IBOutlet UITextField * textField;

+ (OBALabelAndTextFieldTableViewCell*) getOrCreateCellForTableView:(UITableView*)tableView;

@end
@end

NS_ASSUME_NONNULL_END
5 changes: 4 additions & 1 deletion controls/table_cells/OBATextFieldTableViewCell.h
Expand Up @@ -14,8 +14,9 @@
* limitations under the License.
*/

//#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface OBATextFieldTableViewCell : UITableViewCell {
UITextField * _textField;
Expand All @@ -26,3 +27,5 @@
+ (OBATextFieldTableViewCell*) getOrCreateCellForTableView:(UITableView*)tableView;

@end

NS_ASSUME_NONNULL_END
9 changes: 6 additions & 3 deletions controls/toolbars/OBASearchResultsMapFilterToolbar.h
Expand Up @@ -14,9 +14,10 @@
* limitations under the License.
*/


@class OBAApplicationDelegate;

NS_ASSUME_NONNULL_BEGIN

@interface OBASearchResultsMapFilterToolbar : UIToolbar {
NSString * _filterDescription;
BOOL _currentlyShowing;
Expand All @@ -28,12 +29,14 @@
UILabel * _descOutput; // "Route 8" or "Transit Agencies", etc
}

@property (nonatomic, strong) NSString * filterDescription;
@property (nonatomic, strong) OBAApplicationDelegate * appDelegate;
@property (nonatomic,strong,nullable) NSString *filterDescription;
@property (nonatomic,strong) OBAApplicationDelegate *appDelegate;

-(OBASearchResultsMapFilterToolbar*) initWithDelegate:(id)delegate andappDelegate:(OBAApplicationDelegate*)context;

-(void) showWithDescription:(NSString*)filterDescString animated:(BOOL)animated;
-(void) hideWithAnimated:(BOOL)animated;

@end

NS_ASSUME_NONNULL_END
5 changes: 4 additions & 1 deletion controls/view_controllers/OBAListSelectionViewController.h
@@ -1,9 +1,10 @@

NS_ASSUME_NONNULL_BEGIN

@protocol OBAListSelectionViewControllerDelegate <NSObject>
- (void) checkItemWithIndex:(NSIndexPath*)indexPath;
@end


@interface OBAListSelectionViewController : UITableViewController

@property (nonatomic,strong) NSIndexPath *checkedItem;
Expand All @@ -13,3 +14,5 @@
- (id)initWithValues:(NSArray*)values selectedIndex:(NSIndexPath*)selectedIndex;

@end

NS_ASSUME_NONNULL_END
Expand Up @@ -2,6 +2,8 @@
#import "OBAProgressIndicatorView.h"
#import "UITableViewController+oba_Additions.h"

NS_ASSUME_NONNULL_BEGIN

@interface OBARequestDrivenTableViewController : UITableViewController

- (id)initWithApplicationDelegate:(OBAApplicationDelegate *)appDelegate;
Expand Down Expand Up @@ -39,3 +41,5 @@
- (void)refreshFailedWithError:(NSError *)error;

@end

NS_ASSUME_NONNULL_END
3 changes: 3 additions & 0 deletions controls/view_controllers/OBATextEditViewController.h
@@ -1,4 +1,5 @@

NS_ASSUME_NONNULL_BEGIN

@protocol OBATextEditViewControllerDelegate <NSObject>
- (void) saveText:(NSString*)text;
Expand All @@ -15,3 +16,5 @@
- (IBAction)save:(id)sender;

@end

NS_ASSUME_NONNULL_END
8 changes: 5 additions & 3 deletions controls/view_controllers/OBAWebViewController.h
@@ -1,7 +1,9 @@
@interface OBAWebViewController : UIViewController <UIWebViewDelegate> {
#import <UIKit/UIKit.h>

}
NS_ASSUME_NONNULL_BEGIN

@interface OBAWebViewController : UIViewController <UIWebViewDelegate>
+(OBAWebViewController*)pushOntoViewController:(UIViewController*)parent withHtml:(NSString*)html withTitle:(NSString*)title;
@end

@end
NS_ASSUME_NONNULL_END
10 changes: 6 additions & 4 deletions location/OBARegionHelper.h
Expand Up @@ -10,9 +10,11 @@
#import "OBAModelService.h"
#import "OBARegionV2.h"

@interface OBARegionHelper : NSObject <OBALocationManagerDelegate>

NS_ASSUME_NONNULL_BEGIN

- (void) updateNearestRegion;
- (void) updateRegion;
@interface OBARegionHelper : NSObject <OBALocationManagerDelegate>
- (void)updateNearestRegion;
- (void)updateRegion;
@end

NS_ASSUME_NONNULL_END

0 comments on commit 65a5964

Please sign in to comment.