Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Added nullable & nonnull markup for Swift support #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions YoutubeParser/Classes/HCYoutubeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef enum {
@param youtubeURL the the complete youtube video url, either youtu.be or youtube.com
@return string with desired youtube id
*/
+ (NSString *)youtubeIDFromYoutubeURL:(NSURL *)youtubeURL;
+ (nullable NSString *)youtubeIDFromYoutubeURL:(nullable NSURL *)youtubeURL;

/**
Method for retreiving a iOS supported video link
Expand All @@ -62,7 +62,7 @@ typedef enum {
@return dictionary with the available formats for the selected video

*/
+ (NSDictionary *)h264videosWithYoutubeURL:(NSURL *)youtubeURL;
+ (nullable NSDictionary *)h264videosWithYoutubeURL:(nullable NSURL *)youtubeURL;

/**
Method for retreiving an iOS supported video link
Expand All @@ -71,7 +71,7 @@ typedef enum {
@return dictionary with the available formats for the selected video

*/
+ (NSDictionary *)h264videosWithYoutubeID:(NSString *)youtubeID;
+ (nullable NSDictionary *)h264videosWithYoutubeID:(nullable NSString *)youtubeID;

/**
Block based method for retreiving a iOS supported video link
Expand All @@ -80,16 +80,16 @@ typedef enum {
@param completeBlock the block which is called on completion

*/
+ (void)h264videosWithYoutubeURL:(NSURL *)youtubeURL
completeBlock:(void(^)(NSDictionary *videoDictionary, NSError *error))completeBlock;
+ (void)h264videosWithYoutubeURL:(nullable NSURL *)youtubeURL
completeBlock:(nonnull void(^)( NSDictionary * _Nullable videoDictionary, NSError * _Nullable error))completeBlock;

/**
Method for retreiving a thumbnail url for wanted youtube id

@param youtubeURL the complete youtube video id
@param thumbnailSize the wanted size of the thumbnail
*/
+ (NSURL *)thumbnailUrlForYoutubeURL:(NSURL *)youtubeURL
+ (nullable NSURL *)thumbnailUrlForYoutubeURL:(nullable NSURL *)youtubeURL
thumbnailSize:(YouTubeThumbnail)thumbnailSize;

/**
Expand All @@ -99,9 +99,9 @@ typedef enum {
@param thumbnailSize the wanted size of the thumbnail
@param completeBlock the block which is called on completion
*/
+ (void)thumbnailForYoutubeURL:(NSURL *)youtubeURL
+ (void)thumbnailForYoutubeURL:(nullable NSURL *)youtubeURL
thumbnailSize:(YouTubeThumbnail)thumbnailSize
completeBlock:(void(^)(HCImage *image, NSError *error))completeBlock;
completeBlock:(nonnull void(^)(HCImage * _Nullable image, NSError * _Nullable error))completeBlock;

/**
Method for retreiving a thumbnail for wanted youtube id
Expand All @@ -110,9 +110,9 @@ typedef enum {
@param thumbnailSize the wanted size of the thumbnail
@param completeBlock the block which is called on completion
*/
+ (void)thumbnailForYoutubeID:(NSString *)youtubeID
+ (void)thumbnailForYoutubeID:(nullable NSString *)youtubeID
thumbnailSize:(YouTubeThumbnail)thumbnailSize
completeBlock:(void(^)(HCImage *image, NSError *error))completeBlock;
completeBlock:(nonnull void(^)(HCImage * _Nullable image, NSError * _Nullable error))completeBlock;


/**
Expand All @@ -122,6 +122,6 @@ typedef enum {
@param completeBlock the block which is called on completion

*/
+ (void)detailsForYouTubeURL:(NSURL *)youtubeURL
completeBlock:(void(^)(NSDictionary *details, NSError *error))completeBlock;
+ (void)detailsForYouTubeURL:(nullable NSURL *)youtubeURL
completeBlock:(nonnull void(^)(NSDictionary * _Nullable details, NSError * _Nullable error))completeBlock;
@end
2 changes: 1 addition & 1 deletion YoutubeParser/Classes/HCYoutubeParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ + (NSDictionary *)h264videosWithYoutubeURL:(NSURL *)youtubeURL {
}

+ (void)h264videosWithYoutubeURL:(NSURL *)youtubeURL
completeBlock:(void(^)(NSDictionary *videoDictionary, NSError *error))completeBlock {
completeBlock:(void(^)(NSDictionary * _Nullable videoDictionary, NSError * _Nullable error))completeBlock {
NSString *youtubeID = [self youtubeIDFromYoutubeURL:youtubeURL];
if (youtubeID) {
dispatch_queue_t queue = dispatch_queue_create("me.hiddencode.yt.backgroundqueue", 0);
Expand Down