2020 Developer Tools
WWDC20 · 23 min · Developer Tools
Advancements in the Objective-C runtime
Dive into the microscopic world of low-level bits and bytes that underlie every Objective-C and Swift class. Find out how recent changes to internal data structures, method lists, and tagged pointers provide better performance and lower memory usage. We’ll demonstrate how to recognize and fix crashes in code that depend on internal details, and show you how to keep your code unaffected by changes to the runtime.
Watch at developer.apple.com ↗Code shown on screen · 4 snippets
Use the heap command to calculate memory savings
heap Mail | egrep 'class_rw|COUNT' Use the APIs
class_getName
class_getSuperclass
class_copyMethodList Use the APIs
method_getName
method_getTypeEncoding
method_getImplementation Use the APIs
if ([obj isKindOfClass:[NSString class]]) {
// a string
}
NSUInteger length = [obj length];
if (CFGetTypeID(obj) == CFStringGetTypeID()) {
// a string
}
CFIndex length = CFStringGetLength(obj); Resources
Related sessions
-
23 min