()
| 598 | } |
| 599 | |
| 600 | fn register_scene_delegate() { |
| 601 | if AnyClass::get(c"PerrySceneDelegate").is_some() { return; } |
| 602 | |
| 603 | unsafe { |
| 604 | let superclass = AnyClass::get(c"UIResponder").unwrap(); |
| 605 | let cls = objc_allocateClassPair(superclass as *const AnyClass, b"PerrySceneDelegate\0".as_ptr(), 0); |
| 606 | if cls.is_null() { return; } |
| 607 | |
| 608 | // scene:willConnectToSession:connectionOptions: |
| 609 | let sel = Sel::register(c"scene:willConnectToSession:connectionOptions:"); |
| 610 | let types = b"v48@0:8@16@24@32\0".as_ptr(); |
| 611 | class_addMethod(cls, sel, scene_will_connect as *const c_void, types); |
| 612 | |
| 613 | // Add UIWindowSceneDelegate protocol |
| 614 | extern "C" { fn objc_getProtocol(name: *const u8) -> *const c_void; } |
| 615 | let protocol = objc_getProtocol(b"UIWindowSceneDelegate\0".as_ptr()); |
| 616 | if !protocol.is_null() { |
| 617 | extern "C" { fn class_addProtocol(cls: *mut AnyClass, protocol: *const c_void) -> bool; } |
| 618 | class_addProtocol(cls, protocol); |
| 619 | } |
| 620 | |
| 621 | objc_registerClassPair(cls); |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | // ============================================================ |
| 626 | // Minimal pollster |
no test coverage detected