-
Notifications
You must be signed in to change notification settings - Fork 48
updates API with Designated and Unavailable initializers #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
2020Deception
wants to merge
4
commits into
Yelp:master
Choose a base branch
from
2020Deception:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// GeoBoundingBox.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/22/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
@class YLPCoordinate; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPGeoBoundingBox : YLPBaseObject | ||
|
||
@property (nonatomic, copy, readonly) YLPCoordinate *southwestCoordinate; | ||
@property (nonatomic, copy, readonly) YLPCoordinate *northeastCoordinate; | ||
|
||
- (instancetype)initWithSouthWestLongitude:(double)southwestLongitude | ||
southWestLatitude:(double)southwestLatitude | ||
northEastLatitude:(double)northeastLatitude | ||
northEastLongitude:(double)northeastLongitude NS_DESIGNATED_INITIALIZER; | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// YLPGeoCoordinate.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/25/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
@class YLPCoordinate; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPGeoCoordinate : YLPBaseObject | ||
|
||
@property (nonatomic, copy, readonly) YLPCoordinate *coordinate; | ||
@property (nonatomic, readonly) double accuracy; | ||
@property (nonatomic, readonly) double altitude; | ||
@property (nonatomic, readonly) double altitudeAccuracy; | ||
|
||
- (instancetype)initWithLatitude:(double)latitude | ||
longitude:(double)longitude | ||
accuracy:(double)accuracy | ||
altitude:(double)altitude | ||
altitudeAccuracy:(double)altitudeAccuracy NS_DESIGNATED_INITIALIZER; | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// YLPBaseObject.h | ||
// YelpAPI | ||
// | ||
// Created by Brian Sharrief Alim Bowman on 11/7/16. | ||
// | ||
// | ||
|
||
@import Foundation; | ||
|
||
@interface YLPBaseObject : NSObject | ||
|
||
+ (instancetype)new NS_UNAVAILABLE; | ||
|
||
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// YLPBaseObject.m | ||
// YelpAPI | ||
// | ||
// Created by Brian Sharrief Alim Bowman on 11/7/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
@implementation YLPBaseObject | ||
|
||
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// YLPCoordinateDelta.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/20/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPCoordinateDelta : YLPBaseObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property (nonatomic, readonly) double latitudeDelta; | ||
@property (nonatomic, readonly) double longitudeDelta; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// YLPDeal.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/15/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
@class YLPDealOption; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPDeal : YLPBaseObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property (nonatomic, copy, readonly) NSString *identifier; | ||
@property (nonatomic, copy, readonly) NSString *title; | ||
@property (nonatomic, copy, readonly) NSString *currencyCode; | ||
@property (nonatomic, copy, readonly) NSString *whatYouGet; | ||
@property (nonatomic, copy, readonly) NSString *additionalRestrictions; | ||
@property (nonatomic, copy, nullable, readonly) NSString *importantRestrictions; | ||
|
||
@property (nonatomic, copy, readonly) NSURL *URL; | ||
@property (nonatomic, copy, readonly) NSURL *imageURL; | ||
|
||
@property (nonatomic, copy, readonly) NSDate *timeStart; | ||
@property (nonatomic, copy, nullable, readonly) NSDate *timeEnd; | ||
|
||
@property (nonatomic, getter=isPopular, readonly) BOOL popular; | ||
|
||
@property (nonatomic, copy, readonly) NSArray<YLPDealOption *> *options; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// YLPDealOption.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/15/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPDealOption : YLPBaseObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property (nonatomic, copy, readonly) NSString *title; | ||
@property (nonatomic, copy, readonly) NSString *formattedPrice; | ||
@property (nonatomic, copy, readonly) NSString *formattedOriginalPrice; | ||
|
||
@property (nonatomic, copy, readonly) NSURL *purchaseURL; | ||
|
||
@property (nonatomic, readonly) NSUInteger price; | ||
@property (nonatomic, readonly) NSUInteger originalPrice; | ||
@property (nonatomic, copy, nullable, readonly) NSNumber *remainingCount; | ||
|
||
@property (nonatomic, getter=isQuantityLimited, readonly) BOOL quantityLimited; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// YLPGiftCertificate.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/13/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
@class YLPGiftCertificateOption; | ||
|
||
typedef NS_ENUM(NSInteger, YLPBalanceType) { | ||
YLPBalanceTypeCash, | ||
YLPBalanceTypeCredit | ||
}; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPGiftCertificate : YLPBaseObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property (nonatomic, copy, readonly) NSString *identifier; | ||
@property (nonatomic, copy, readonly) NSString *currencyCode; | ||
@property (nonatomic, readonly) YLPBalanceType unusedBalances; | ||
|
||
@property (nonatomic, copy, readonly) NSURL *URL; | ||
@property (nonatomic, copy, readonly) NSURL *imageURL; | ||
|
||
@property (nonatomic, copy, readonly) NSArray<YLPGiftCertificateOption *> *options; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// YLPGiftCertificateOption.h | ||
// Pods | ||
// | ||
// Created by David Chen on 1/14/16. | ||
// | ||
// | ||
|
||
#import "YLPBaseObject.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YLPGiftCertificateOption : YLPBaseObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property (nonatomic, readonly) NSUInteger price; | ||
@property (nonatomic, copy, readonly) NSString *formattedPrice; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I hadn't even thought about
+new
... is it necessary to annotate both-init
and+new
? i.e. will Swift still let you call things likeYLPBusiness()
if-init
is unavailable but+new
is still available?I'm learning new things about swift interop all the time 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I typically do to avoid unwanted initializers if we want to force users building on top of the API to use a certain initializer. I'm open to leaving it available but for the objective c people it may avoid unwanted confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's a fair point, I guess I was thinking mainly that
YLPBaseObject
seems a little odd as a class with no functionality.I'm debating whether it's worth it or if it'd be fine to just copy-paste this
+ (instancetype)new NS_UNAVAILABLE
line everywhere... the convenience of only having to write it once is pretty nice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea its a pet peeve of mine to write the same code all over the place. I can adjust it however you like. The base may come in handy later if other functionality comes up that will be shared. I'll review the API changes and update sometime between tonight and tomorrow. Just let me know about other changes you like, i'll be happy to make them!