Instantly share code, notes, and snippets.

View README.md
View Overview.md

legacy = UIGraphicsBeginImageContextWithOptions + UIGraphicsEndImageContext

modern = UIGraphicsImageRendererFormat + UIGraphicsImageRenderer

Take aways:

  • "modern" w/ prefersExtendedRange = NO
    • basically the same perf as "legacy"
    • probably a good idea to adopt since optimizations will likely be in "modern" first
  • "modern" w/ prefersExtendedRange = YES
View MyDebugCoder.m
@interface MyDebugCoder : NSCoder
+ (NSDictionary *)serializedJSONWithRootObject:(id<NSCoding, NSObject>)object;
@end
@implementation MyDebugCoder
{
NSMutableDictionary *_jsonRoot;
NSMutableArray *_values;
}
View CFRuntimeBase_struct_size.m
static size_t _CFRuntimeBaseGetSize()
{
static size_t sSize = 0;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// CFUUID has a very nice feature in that it's structure
// is always the CFRuntimeBase struct (which we don't have access to)
// followed by a UUID in bytes.
// By simply traversing the CFUUID structs byte layout until we find