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
#import <Foundation/Foundation.h> | |
typedef NS_ENUM(unsigned char, MyTreeVisitingOrder) { | |
MyTreeOrderDepthFirst, | |
MyTreeOrderValueFirst | |
}; | |
#define Tree NSObject<MyTree> | |
@protocol MyTree |
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
CC=clang | |
CFLAGS+=-std=c99 -g | |
LDFLAGS+=-framework Foundation | |
dispatch_once_reentrancy_test: dispatch_once_reentrancy_test.o |
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
@interface Animal : NSObject | |
{ | |
NSObject *iProtected; | |
@package | |
NSObject *iPackage; | |
@private | |
NSObject *iPrivate; | |
@protected | |
NSObject *iProtected2; // default access. Only visible to subclasses. | |
@public |
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
#import <Foundation/Foundation.h> | |
// clang -framework Foundation main.m -o main && ./main | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSUInteger (^__block factorial)(NSUInteger n); | |
NSUInteger (^__block __weak weakFactorial)(NSUInteger n); | |
weakFactorial = factorial = ^ NSUInteger (NSUInteger n) { | |
return n==0 ? 1 : n * weakFactorial(n-1); | |
}; |
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
@interface NutritionFacts(Builder) | |
-(NutritionFactsBuilder*)builder; | |
@end | |
@implementation NutritionFacts(Builder) | |
-(NutritionFactsBuilder*)builder { | |
return [[NutritionFactsBuilder alloc]initWithNutritionFacts:self]; | |
} | |
@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
#import <Foundation/Foundation.h> | |
#include <stdlib.h> | |
#include <objc/runtime.h> | |
@interface A : NSObject | |
@property (assign) int meaning; | |
@end | |
@implementation A | |
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
#include <objc/runtime.h> | |
#import <Foundation/Foundation.h> | |
@interface Hi : NSObject | |
@end | |
@implementation Hi { | |
NSString *something; | |
} |
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
// Not App Store safe. Only available in real devices. | |
#define RTLD_LAZY 0x1 | |
#define RTLD_NOW 0x2 | |
#define RTLD_LOCAL 0x4 | |
#define RTLD_GLOBAL 0x8 | |
NSObject *voiceSynthesizer; | |
void *voiceServices; |
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
#import <Foundation/Foundation.h> | |
@interface MySingleton : NSObject | |
+(instancetype) sharedInstance; | |
// clue for improper use (produces compile time error) | |
+(instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead"))); | |
-(instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead"))); | |
+(instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead"))); |
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
#!/bin/bash | |
# This script builds the iOS and Mac openSSL libraries | |
# It's expanded from https://github.com/st3fan/ios-openssl | |
set -xe | |
# Setup paths to stuff we need | |
OPENSSL_VERSION="1.0.1e" |