Skip to content

Instantly share code, notes, and snippets.

@nolili
Created February 10, 2016 07:04
Show Gist options
  • Save nolili/355ed163aa5dac77dfe9 to your computer and use it in GitHub Desktop.
Save nolili/355ed163aa5dac77dfe9 to your computer and use it in GitHub Desktop.
NSStream Debugging (Helper)
#import <Foundation/Foundation.h>
@interface NSStream (Helper)
+ (NSString *)descriptionFromEvent:(NSStreamEvent)event;
@end
#import "NSStream+Helper.h"
@implementation NSStream(Helper)
+ (NSString *)descriptionFromEvent:(NSStreamEvent)event;
{
switch (event) {
case NSStreamEventNone:
return @"NSStreamEventNone";
case NSStreamEventOpenCompleted:
return @"NSStreamEventOpenCompleted";
case NSStreamEventHasBytesAvailable:
return @"NSStreamEventHasBytesAvailable";
case NSStreamEventHasSpaceAvailable:
return @"NSStreamEventHasSpaceAvailable";
case NSStreamEventErrorOccurred:
return @"NSStreamEventErrorOccurred";
case NSStreamEventEndEncountered:
return @"NSStreamEventEndEncountered";
}
return nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment