importSwiftUIimportUIKitstructMastgTest{staticfuncmastgTest(completion:@escaping(String)->Void){DispatchQueue.main.async{//Buildthealertletalert=UIAlertController(title:"Enter sensitive text",message:"Please fill in all fields.",preferredStyle:.alert)alert.addTextField{tfintf.placeholder="Name"tf.autocorrectionType=.defaulttf.spellCheckingType=.notf.accessibilityIdentifier="name_field"}alert.addTextField{tfintf.placeholder="E-Mail"tf.autocorrectionType=.notf.accessibilityIdentifier="email_field"}alert.addTextField{tfintf.placeholder="Password"tf.isSecureTextEntry=truetf.accessibilityIdentifier="password_field"}alert.addAction(UIAlertAction(title:"OK",style:.default,handler:{_inletfirst=alert.textFields?[0].text??""letsecond=alert.textFields?[1].text??""letthird=alert.textFields?[2].text??""completion("Submitted values: '\(first)', '\(second)', \(third)")}))//Presentfromthetopmostviewcontrollerifletpresenter=topViewController(){presenter.present(alert,animated:true,completion:nil)}else{completion("Failed to present alert (no active view controller).")}}}//FindsthecurrentlyvisibleviewcontrollertopresentfromprivatestaticfunctopViewController(base:UIViewController?={letscenes=UIApplication.shared.connectedScenes.compactMap{$0as?UIWindowScene}letkeyWindow=scenes.flatMap{$0.windows}.first{$0.isKeyWindow}returnkeyWindow?.rootViewController}())->UIViewController?{ifletnav=baseas?UINavigationController{returntopViewController(base:nav.visibleViewController)}iflettab=baseas?UITabBarController{returntopViewController(base:tab.selectedViewController)}ifletpresented=base?.presentedViewController{returntopViewController(base:presented)}returnbase}}
e asm.bytes=false
e scr.color=false
e asm.var=false
?e Print flags about \"UITextField,UITextView,UISearchBar\"
f~+UITextField,UITextView,UISearchBar
?e Print xrefs to 0x100010180
axt @ 0x100010180
?e Print flags about \"autocorrectionType,setSecureTextEntry,spellCheckingType\"
f~+autocorrectionType,setSecureTextEntry,spellCheckingType
?e
?e Print xrefs to 0x100010110
axt @ 0x100010110
?e Print xrefs to 0x100010120
axt @ 0x100010120
?e Print xrefs to 0x100010128
axt @ 0x100010128
?e
?e Print disassembly around \"name_field\" in the function
pd--10 @ 0x100004550
?e
?e Print disassembly around \"email_field\" in the function
pd--10 @ 0x100004604
?e
?e Print disassembly around \"password_field\" in the function
pd--10 @ 0x1000046b0
Although MastgTest.swift is written in Swift, it interacts with UIKit (an Objective-C framework). The compiler translates these interactions into calls to the objc_msgSend function. We analyze the arguments passed to this function using the ARM64 calling convention:
x0 register: holds self (the instance of the UITextField).
x1 register: holds the selector (the method name).
x2 register: holds the argument passed to that method.
1. Name Field (FAIL):
At address 0x100004550, the binary loads the selector setAutocorrectionType:.
Immediately after, at address 0x100004558, the instruction mov x2, 0 sets the argument to 0.
Alternatively, you can view the full UITextInputTraits.h header online in public SDK mirrors on GitHub such as GitHub - xybp888/iOS-SDKs.
This confirms that for the input field labeled "Name" (placeholder string constructed earlier in the function), the app explicitly allows the default behavior, enabling the keyboard cache.
Note that there is a call to setSpellCheckingType: at address 0x100004564, and it sets the argument to 1 (i.e., UITextSpellCheckingTypeNo), which correctly disables spell checking. However, since autocorrection is still set to default, this input remains eligible for keyboard caching.
2. Email Field (FAIL):
For the input field labeled "E-Mail", the selector setAutocorrectionType: is loaded at 0x100004604. The argument is set at 0x10000460c via mov w2, 1, corresponding to UITextAutocorrectionTypeNo.
However, no call to setSpellCheckingType(.no) exists for this field. Since spellCheckingType remains at its default value, this input is still eligible for keyboard caching and therefore fails the test.
3. Password Field (PASS):
The selector setSecureTextEntry: is loaded at address 0x1000046b0 and its argument is set to 1 at address 0x1000046b8 using mov w2, 1.
This confirms that isSecureTextEntry is enabled for the field labeled "Password", which disables keyboard caching and correctly protects sensitive input.