ffi 1.28 follow-up: keyboard BOOL returns use #objc_call(bool)

Apple documents `-becomeFirstResponder` and `-resignFirstResponder` as
returning `BOOL`. The pre-`#objc_call` cast pattern in this file used
`u8` because BOOL is ABI-equivalent to a 1-byte unsigned integer on
both i386 (signed char) and arm64 (`bool`). The initial 1.28
migration carried that `u8` typing forward without question; switching
to `bool` matches the documented API and aligns with the BOOL→bool
mapping called out in PLAN-FFI.md Phase 3.

First standalone exercise of `#objc_call(bool)`. The lowering is
identical to `#objc_call(u8)` at the ABI layer (single byte in `w0`
on AAPCS64), but the source-level type is now meaningful.
This commit is contained in:
agra
2026-05-19 19:39:56 +03:00
parent 65643fb0ed
commit ee53348ce0

View File

@@ -220,14 +220,14 @@ impl Platform for UIKitPlatform {
show_keyboard :: (self: *UIKitPlatform) {
inline if OS == .ios {
if self.text_field == null { return; }
#objc_call(u8)(self.text_field, "becomeFirstResponder");
#objc_call(bool)(self.text_field, "becomeFirstResponder");
}
}
hide_keyboard :: (self: *UIKitPlatform) {
inline if OS == .ios {
if self.text_field == null { return; }
#objc_call(u8)(self.text_field, "resignFirstResponder");
#objc_call(bool)(self.text_field, "resignFirstResponder");
}
}