Run a virtual iPhone on an Apple Silicon Mac.
Swift
expr -l objc -O --
NSMutableString *vpOut = [NSMutableString string];
NSArray *vpNames = @[@"UIApplication", @"UIScene", @"UIWindowScene", @"UIScreen", @"FBSScene", @"FBSSceneSettings", @"UIWindow", @"UITraitCollection", @"SpringBoard", @"SBWindowScene", @"BKSAccelerometer", @"SBDisplayToolServiceCoordinator", @"FBSDisplayConfiguration", @"_UISceneHingeStateExtension", @"_UISceneHingeStateConfiguration", @"UIHinge"];
NSRegularExpression *vpRe = [NSRegularExpression regularExpressionWithPattern:@"hinge|pose|fold|tabletop|posture|magic|flip|surface|cover|inner" options:NSRegularExpressionCaseInsensitive error:nil];
for (NSString *vpN in vpNames) {
Class vpC = NSClassFromString(vpN);
if (!vpC) { [vpOut appendFormat:@"=== %@: MISSING\n", vpN]; continue; }
[vpOut appendFormat:@"=== %@\n", vpN];
for (int vk = 0; vk < 2; vk++) {
Class vpT = vk ? object_getClass(vpC) : vpC;
unsigned int vpCount = 0; Method *vpM = class_copyMethodList(vpT, &vpCount);
for (unsigned int vj = 0; vj < vpCount; vj++) {
NSString *vpS = NSStringFromSelector(method_getName(vpM[vj]));
if ([vpRe numberOfMatchesInString:vpS options:0 range:NSMakeRange(0, vpS.length)])
[vpOut appendFormat:@" %s%@ %s\n", vk ? "+" : "-", vpS, method_getTypeEncoding(vpM[vj])];
}
free(vpM);
}
unsigned int vpIC = 0; Ivar *vpIv = class_copyIvarList(vpC, &vpIC);
for (unsigned int vj = 0; vj < vpIC; vj++) {
NSString *vpS = [NSString stringWithUTF8String:ivar_getName(vpIv[vj])];
if ([vpRe numberOfMatchesInString:vpS options:0 range:NSMakeRange(0, vpS.length)]) [vpOut appendFormat:@" ivar %@ %s\n", vpS, ivar_getTypeEncoding(vpIv[vj])];
}
free(vpIv);
}
id vpApp = [UIApplication sharedApplication];
id vpProv = [[[vpApp valueForKey:@"_displayToolService"] valueForKey:@"_swapCoordinator"] valueForKey:@"_devicePoseProvider"];
[vpOut appendString:@"=== holders of the SBFDevicePoseProvider among SpringBoard ivars\n"];
for (Class vpC = object_getClass(vpApp); vpC; vpC = class_getSuperclass(vpC)) {
unsigned int vpIC = 0; Ivar *vpIv = class_copyIvarList(vpC, &vpIC);
for (unsigned int vj = 0; vj < vpIC; vj++) {
const char *vpT = ivar_getTypeEncoding(vpIv[vj]);
if (vpT[0] != '@') continue;
id vpV = object_getIvar(vpApp, vpIv[vj]);
if (!vpV) continue;
if (vpV == vpProv) [vpOut appendFormat:@" %@.%s == provider\n", NSStringFromClass(vpC), ivar_getName(vpIv[vj])];
else {
unsigned int vpIC2 = 0; Ivar *vpIv2 = class_copyIvarList(object_getClass(vpV), &vpIC2);
for (unsigned int vq = 0; vq < vpIC2; vq++) {
if (ivar_getTypeEncoding(vpIv2[vq])[0] != '@') continue;
if (object_getIvar(vpV, vpIv2[vq]) == vpProv) [vpOut appendFormat:@" %@.%s(%@).%s == provider\n", NSStringFromClass(vpC), ivar_getName(vpIv[vj]), NSStringFromClass(object_getClass(vpV)), ivar_getName(vpIv2[vq])];
}
free(vpIv2);
}
}
free(vpIv);
}
[vpOut appendFormat:@"provider observers: %@\n", [(NSObject *)[[vpProv valueForKey:@"_observers"] allObjects] description]];
[vpOut appendFormat:@"likelyTransitionDelegate: %@\n", [(NSObject *)[vpProv valueForKey:@"_likelyTransitionDelegate"] description]];
vpOut