diff --git a/library/modules/platform/uikit.sx b/library/modules/platform/uikit.sx index 665b0b7..e071c34 100644 --- a/library/modules/platform/uikit.sx +++ b/library/modules/platform/uikit.sx @@ -355,42 +355,28 @@ uikit_keyboard_will_change_frame :: (self: *void, _cmd: *void, notification: *vo if g_uikit_plat == null { return; } plat := g_uikit_plat; - sel_user_info := sel_registerName("userInfo".ptr); - sel_obj_for_key := sel_registerName("objectForKey:".ptr); - sel_cg_rect_value := sel_registerName("CGRectValue".ptr); - sel_double_value := sel_registerName("doubleValue".ptr); - sel_screen := sel_registerName("screen".ptr); - sel_bounds := sel_registerName("bounds".ptr); - - msg_o : (*void, *void) -> *void = xx objc_msgSend; - msg_oo : (*void, *void, *void) -> *void = xx objc_msgSend; - msg_rect : (*void, *void) -> CGRect = xx objc_msgSend; - msg_d : (*void, *void) -> f64 = xx objc_msgSend; - - user_info := msg_o(notification, sel_user_info); + user_info := #objc_call(*void)(notification, "userInfo"); if user_info == null { return; } - end_value := msg_oo(user_info, sel_obj_for_key, + end_value := #objc_call(*void)(user_info, "objectForKey:", ns_string("UIKeyboardFrameEndUserInfoKey".ptr)); if end_value == null { return; } - end_rect := msg_rect(end_value, sel_cg_rect_value); + end_rect := #objc_call(CGRect)(end_value, "CGRectValue"); - dur_value := msg_oo(user_info, sel_obj_for_key, + dur_value := #objc_call(*void)(user_info, "objectForKey:", ns_string("UIKeyboardAnimationDurationUserInfoKey".ptr)); anim_dur : f64 = 0.0; - if dur_value != null { anim_dur = msg_d(dur_value, sel_double_value); } + if dur_value != null { anim_dur = #objc_call(f64)(dur_value, "doubleValue"); } - sel_unsigned_long_value := sel_registerName("unsignedLongValue".ptr); - msg_ul : (*void, *void) -> u64 = xx objc_msgSend; - curve_value := msg_oo(user_info, sel_obj_for_key, + curve_value := #objc_call(*void)(user_info, "objectForKey:", ns_string("UIKeyboardAnimationCurveUserInfoKey".ptr)); curve_int : u64 = 0; - if curve_value != null { curve_int = msg_ul(curve_value, sel_unsigned_long_value); } + if curve_value != null { curve_int = #objc_call(u64)(curve_value, "unsignedLongValue"); } // Screen height in points. The window lives on the connected scene's screen. if plat.window == null { return; } - win_screen := msg_o(plat.window, sel_screen); - screen_bounds := msg_rect(win_screen, sel_bounds); + win_screen := #objc_call(*void)(plat.window, "screen"); + screen_bounds := #objc_call(CGRect)(win_screen, "bounds"); // Keyboard height = how much of the screen the keyboard covers from the // bottom. When the keyboard is hiding, its end-frame.y == screen.height,