├── .github ├── SECURITY.md └── workflows │ └── ci.yml ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE.md ├── README.md ├── assets ├── design-files.kra ├── github-social-preview.png ├── logo-small.png └── logo.png ├── crates ├── block2 │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── abi.rs │ │ ├── block.rs │ │ ├── debug.rs │ │ ├── encoding.rs │ │ ├── ffi.rs │ │ ├── global.rs │ │ ├── lib.rs │ │ ├── rc_block.rs │ │ ├── stack.rs │ │ └── traits.rs │ └── translation-config.toml ├── dispatch2 │ ├── CHANGELOG.md │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── TODO.md │ ├── src │ │ ├── data.rs │ │ ├── generated │ │ ├── group.rs │ │ ├── io.rs │ │ ├── lib.rs │ │ ├── macros.rs │ │ ├── main_thread_bound.rs │ │ ├── object.rs │ │ ├── once.rs │ │ ├── queue.rs │ │ ├── retained.rs │ │ ├── retained │ │ │ └── forwarding_impls.rs │ │ ├── semaphore.rs │ │ ├── source.rs │ │ ├── time.rs │ │ ├── utils.rs │ │ └── workloop.rs │ └── translation-config.toml ├── header-translator │ ├── Cargo.toml │ ├── README.md │ ├── configs │ │ ├── bitflags.toml │ │ ├── builtin.toml │ │ ├── core.toml │ │ ├── libc.toml │ │ └── skipped.toml │ └── src │ │ ├── CFDatabase.def │ │ ├── availability.rs │ │ ├── bin │ │ ├── check_all_frameworks_known.rs │ │ └── check_framework_features.rs │ │ ├── cfgs.rs │ │ ├── config.rs │ │ ├── context.rs │ │ ├── default_cargo.toml │ │ ├── display_helper.rs │ │ ├── documentation.rs │ │ ├── expr.rs │ │ ├── fn_utils.rs │ │ ├── global_analysis.rs │ │ ├── id.rs │ │ ├── lib.rs │ │ ├── library.rs │ │ ├── main.rs │ │ ├── method.rs │ │ ├── module.rs │ │ ├── name_translation.rs │ │ ├── objc2_utils.rs │ │ ├── protocol.rs │ │ ├── rust_type.rs │ │ ├── stmt.rs │ │ ├── thread_safety.rs │ │ └── unexposed_attr.rs ├── objc2-encode │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── encoding.rs │ │ ├── encoding_box.rs │ │ ├── helper.rs │ │ ├── lib.rs │ │ ├── parse.rs │ │ └── static_str.rs ├── objc2-exception-helper │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ └── src │ │ ├── lib.rs │ │ └── try_catch.m ├── objc2-proc-macros │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── lib.rs ├── objc2 │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── benches │ │ └── autorelease.rs │ ├── build.rs │ ├── examples │ │ ├── class_with_lifetime.rs │ │ ├── encode_core_graphics.rs │ │ ├── encode_nsstring.rs │ │ ├── encode_nsuinteger.rs │ │ ├── encode_opaque_type.rs │ │ ├── hello_world_app.rs │ │ └── introspection.rs │ ├── src │ │ ├── __framework_prelude.rs │ │ ├── __macro_helpers │ │ │ ├── cache.rs │ │ │ ├── class.rs │ │ │ ├── common_selectors.rs │ │ │ ├── convert.rs │ │ │ ├── define_class.rs │ │ │ ├── defined_ivars.rs │ │ │ ├── image_info.rs │ │ │ ├── method_family.rs │ │ │ ├── mod.rs │ │ │ ├── module_info.rs │ │ │ ├── msg_send_retained.rs │ │ │ ├── null_error.rs │ │ │ ├── os_version.rs │ │ │ ├── os_version │ │ │ │ └── apple.rs │ │ │ ├── retain_semantics.rs │ │ │ ├── sync_unsafe_cell.rs │ │ │ └── writeback.rs │ │ ├── downcast.rs │ │ ├── encode.rs │ │ ├── exception.rs │ │ ├── ffi │ │ │ ├── class.rs │ │ │ ├── constants.rs │ │ │ ├── exception.rs │ │ │ ├── libc.rs │ │ │ ├── message.rs │ │ │ ├── method.rs │ │ │ ├── mod.rs │ │ │ ├── object.rs │ │ │ ├── property.rs │ │ │ ├── protocol.rs │ │ │ ├── rc.rs │ │ │ ├── selector.rs │ │ │ ├── types.rs │ │ │ └── various.rs │ │ ├── lib.rs │ │ ├── macros │ │ │ ├── __attribute_helpers.rs │ │ │ ├── __fallback.rs │ │ │ ├── __method_msg_send.rs │ │ │ ├── __msg_send_parse.rs │ │ │ ├── __rewrite_self_param.rs │ │ │ ├── available.rs │ │ │ ├── cf_objc2_type.rs │ │ │ ├── define_class.rs │ │ │ ├── extern_class.rs │ │ │ ├── extern_conformance.rs │ │ │ ├── extern_methods.rs │ │ │ ├── extern_protocol.rs │ │ │ └── mod.rs │ │ ├── main_thread_marker.rs │ │ ├── rc │ │ │ ├── allocated_partial_init.rs │ │ │ ├── autorelease.rs │ │ │ ├── mod.rs │ │ │ ├── retained.rs │ │ │ ├── retained_forwarding_impls.rs │ │ │ ├── retained_traits.rs │ │ │ ├── test_object.rs │ │ │ └── weak.rs │ │ ├── runtime │ │ │ ├── __nsstring.rs │ │ │ ├── bool.rs │ │ │ ├── define.rs │ │ │ ├── malloc.rs │ │ │ ├── message_receiver.rs │ │ │ ├── method_encoding_iter.rs │ │ │ ├── method_implementation.rs │ │ │ ├── mod.rs │ │ │ ├── nsobject.rs │ │ │ ├── nsproxy.rs │ │ │ ├── nszone.rs │ │ │ ├── protocol_object.rs │ │ │ └── retain_release_fast.rs │ │ ├── test_utils.rs │ │ ├── top_level_traits.rs │ │ ├── topics │ │ │ ├── about_generated │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── README.md │ │ │ │ ├── cargo_features.md │ │ │ │ ├── deref.md │ │ │ │ ├── list.rs │ │ │ │ ├── list_data.md │ │ │ │ ├── list_unsupported.md │ │ │ │ └── mod.rs │ │ │ ├── alternatives.md │ │ │ ├── crate_interop.md │ │ │ ├── cross_compiling.md │ │ │ ├── goals.md │ │ │ ├── interior_mutability.md │ │ │ ├── kvo.md │ │ │ ├── layered_safety.md │ │ │ ├── migrating_from_objc.md │ │ │ ├── mod.rs │ │ │ ├── mvc.md │ │ │ ├── run_loop.md │ │ │ ├── swift.md │ │ │ └── weak_property.md │ │ └── verify.rs │ ├── tests │ │ ├── backtrace.rs │ │ ├── define_class.rs │ │ ├── define_class_self.rs │ │ ├── extern_class.rs │ │ ├── macros_mainthreadmarker.rs │ │ ├── no_prelude.rs │ │ ├── protocol_shared_retain_count.rs │ │ ├── track_caller.rs │ │ └── use_macros.rs │ └── translation-config.toml ├── test-assembly │ ├── .gitattributes │ ├── Cargo.toml │ ├── build.rs │ ├── crates │ │ ├── test_autorelease_return │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_available │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-old-x86.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_block │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_define_class │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-old-x86.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_dynamic_class │ │ │ ├── Cargo.toml │ │ │ └── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-old-x86.s │ │ │ │ ├── gnustep-old-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ ├── test_dynamic_sel │ │ │ ├── Cargo.toml │ │ │ └── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ ├── test_extern_protocol │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-old-x86.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_fast_enumeration │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_msg_send_error │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_msg_send_retained │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_msg_send_static_sel │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-old-x86.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_msg_send_zero_cost │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_ns_string │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_out_parameters │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_retain_autoreleased │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ ├── test_static_class │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ │ ├── apple-aarch64.s │ │ │ │ ├── apple-armv7s.s │ │ │ │ ├── apple-old-x86.s │ │ │ │ ├── apple-x86.s │ │ │ │ ├── apple-x86_64.s │ │ │ │ ├── gnustep-old-x86.s │ │ │ │ ├── gnustep-old-x86_64.s │ │ │ │ ├── gnustep-x86.s │ │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ │ └── test_static_sel │ │ │ ├── Cargo.toml │ │ │ ├── expected │ │ │ ├── apple-aarch64.s │ │ │ ├── apple-armv7s.s │ │ │ ├── apple-old-x86.s │ │ │ ├── apple-x86.s │ │ │ ├── apple-x86_64.s │ │ │ ├── gnustep-x86.s │ │ │ └── gnustep-x86_64.s │ │ │ └── lib.rs │ ├── run-all.sh │ └── src │ │ ├── lib.rs │ │ └── main.rs ├── test-frameworks │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ └── lib.rs │ └── tests │ │ └── .gitkeep ├── test-fuzz │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── afl │ │ └── .gitkeep │ ├── corpus │ │ ├── class │ │ │ ├── invalid_class │ │ │ ├── nul_ │ │ │ ├── other_class │ │ │ ├── root_class │ │ │ └── unknown │ │ ├── collection_interior_mut │ │ │ └── .gitkeep │ │ ├── encoding_parse │ │ │ └── .gitkeep │ │ ├── nsstring │ │ │ └── .gitkeep │ │ └── sel │ │ │ ├── longer │ │ │ ├── nul_ │ │ │ ├── simple │ │ │ └── with_colon │ └── fuzz_targets │ │ ├── cfstring.rs │ │ ├── cfurl.rs │ │ ├── cfurl_path.rs │ │ ├── class.rs │ │ ├── collection_interior_mut.rs │ │ ├── encoding_parse.rs │ │ ├── mut_while_iter.rs │ │ ├── nsstring.rs │ │ └── sel.rs ├── test-ui │ ├── .gitattributes │ ├── Cargo.toml │ ├── src │ │ ├── hack.rs │ │ ├── lib.rs │ │ └── main.rs │ └── ui │ │ ├── add_method_no_bool.rs │ │ ├── add_method_no_bool.stderr │ │ ├── array_iter_invalid.rs │ │ ├── array_iter_invalid.stderr │ │ ├── autoreleasepool_not_send_sync.rs │ │ ├── autoreleasepool_not_send_sync.stderr │ │ ├── available_invalid.rs │ │ ├── available_invalid.stderr │ │ ├── available_same_os.rs │ │ ├── available_same_os.stderr │ │ ├── available_unknown_os.rs │ │ ├── available_unknown_os.stderr │ │ ├── block_carrying_lifetime.rs │ │ ├── block_carrying_lifetime.stderr │ │ ├── block_inner_wrong_variance.rs │ │ ├── block_inner_wrong_variance.stderr │ │ ├── block_lifetimes_independent.rs │ │ ├── block_lifetimes_independent.stderr │ │ ├── block_parameter_lifetime.rs │ │ ├── block_parameter_lifetime.stderr │ │ ├── cfstring_from_static_str.rs │ │ ├── cfstring_from_static_str.stderr │ │ ├── define_add_bad_method.rs │ │ ├── define_add_bad_method.stderr │ │ ├── define_class_delegate_not_mainthreadonly.rs │ │ ├── define_class_delegate_not_mainthreadonly.stderr │ │ ├── define_class_invalid_receiver.rs │ │ ├── define_class_invalid_receiver.stderr │ │ ├── define_class_invalid_syntax.rs │ │ ├── define_class_invalid_syntax.stderr │ │ ├── define_class_invalid_type.rs │ │ ├── define_class_invalid_type.stderr │ │ ├── define_class_invalid_type2.rs │ │ ├── define_class_invalid_type2.stderr │ │ ├── define_class_mut_self_not_mutable.rs │ │ ├── define_class_mut_self_not_mutable.stderr │ │ ├── downcast_generic.rs │ │ ├── downcast_generic.stderr │ │ ├── extern_class_duplicate.rs │ │ ├── extern_class_duplicate.stderr │ │ ├── extern_class_feature_flag.rs │ │ ├── extern_class_feature_flag.stderr │ │ ├── extern_class_impls_drop.rs │ │ ├── extern_class_impls_drop.stderr │ │ ├── extern_class_ivars.rs │ │ ├── extern_class_ivars.stderr │ │ ├── extern_class_no_super.rs │ │ ├── extern_class_no_super.stderr │ │ ├── extern_class_paren_attrs.rs │ │ ├── extern_class_paren_attrs.stderr │ │ ├── extern_class_root.rs │ │ ├── extern_class_root.stderr │ │ ├── extern_class_safe_super.rs │ │ ├── extern_class_safe_super.stderr │ │ ├── extern_class_subclass_object.rs │ │ ├── extern_class_subclass_object.stderr │ │ ├── extern_class_thread_kind_invalid.rs │ │ ├── extern_class_thread_kind_invalid.stderr │ │ ├── extern_class_thread_kind_main_send_sync.rs │ │ ├── extern_class_thread_kind_main_send_sync.stderr │ │ ├── extern_class_thread_kind_main_to_any.rs │ │ ├── extern_class_thread_kind_main_to_any.stderr │ │ ├── extern_class_with_fields.rs │ │ ├── extern_class_with_fields.stderr │ │ ├── extern_methods_bad_selector.rs │ │ ├── extern_methods_bad_selector.stderr │ │ ├── extern_methods_deprecated.rs │ │ ├── extern_methods_deprecated.stderr │ │ ├── extern_methods_deprecated_syntax.rs │ │ ├── extern_methods_deprecated_syntax.stderr │ │ ├── extern_methods_feature_flag.rs │ │ ├── extern_methods_feature_flag.stderr │ │ ├── extern_methods_invalid_method_family.rs │ │ ├── extern_methods_invalid_method_family.stderr │ │ ├── extern_methods_invalid_receiver.rs │ │ ├── extern_methods_invalid_receiver.stderr │ │ ├── extern_methods_invalid_type.rs │ │ ├── extern_methods_invalid_type.stderr │ │ ├── extern_methods_missing_method.rs │ │ ├── extern_methods_missing_method.stderr │ │ ├── extern_methods_not_allowed_mutable.rs │ │ ├── extern_methods_not_allowed_mutable.stderr │ │ ├── extern_methods_not_unsafe.rs │ │ ├── extern_methods_not_unsafe.stderr │ │ ├── extern_methods_outside_impl.rs │ │ ├── extern_methods_outside_impl.stderr │ │ ├── extern_methods_selector_twice.rs │ │ ├── extern_methods_selector_twice.stderr │ │ ├── extern_methods_variadic.rs │ │ ├── extern_methods_variadic.stderr │ │ ├── extern_methods_wrong_arguments.rs │ │ ├── extern_methods_wrong_arguments.stderr │ │ ├── extern_methods_wrong_arguments_error.rs │ │ ├── extern_methods_wrong_arguments_error.stderr │ │ ├── extern_protocol_invalid.rs │ │ ├── extern_protocol_invalid.stderr │ │ ├── fn_ptr_reference_encode.rs │ │ ├── fn_ptr_reference_encode.stderr │ │ ├── fn_ptr_reference_method.rs │ │ ├── fn_ptr_reference_method.stderr │ │ ├── global_block_args_covariant.rs │ │ ├── global_block_args_covariant.stderr │ │ ├── global_block_not_encode.rs │ │ ├── global_block_not_encode.stderr │ │ ├── implement_protocol_missing_super.rs │ │ ├── implement_protocol_missing_super.stderr │ │ ├── invalid_msg_send.rs │ │ ├── invalid_msg_send.stderr │ │ ├── invalid_msg_send_super.rs │ │ ├── invalid_msg_send_super.stderr │ │ ├── invalid_ns_string_input.rs │ │ ├── invalid_ns_string_input.stderr │ │ ├── invalid_ns_string_output.rs │ │ ├── invalid_ns_string_output.stderr │ │ ├── invalid_option_encode_impl.rs │ │ ├── invalid_option_encode_impl.stderr │ │ ├── invalid_option_encode_impl_ref.rs │ │ ├── invalid_option_encode_impl_ref.stderr │ │ ├── invalid_sel.rs │ │ ├── invalid_sel.stderr │ │ ├── lifetime_of_closure_tied_to_block.rs │ │ ├── lifetime_of_closure_tied_to_block.stderr │ │ ├── main_thread_only_not_allocable.rs │ │ ├── main_thread_only_not_allocable.stderr │ │ ├── mainthreadmarker_from_nsobject.rs │ │ ├── mainthreadmarker_from_nsobject.stderr │ │ ├── mainthreadmarker_not_send_sync.rs │ │ ├── mainthreadmarker_not_send_sync.stderr │ │ ├── message_receiver_simple.rs │ │ ├── message_receiver_simple.stderr │ │ ├── msg_send_alloc_init_different.rs │ │ ├── msg_send_alloc_init_different.stderr │ │ ├── msg_send_invalid_error.rs │ │ ├── msg_send_invalid_error.stderr │ │ ├── msg_send_invalid_error2.rs │ │ ├── msg_send_invalid_error2.stderr │ │ ├── msg_send_invalid_error3.rs │ │ ├── msg_send_invalid_error3.stderr │ │ ├── msg_send_invalid_receiver.rs │ │ ├── msg_send_invalid_receiver.stderr │ │ ├── msg_send_invalid_return.rs │ │ ├── msg_send_invalid_return.stderr │ │ ├── msg_send_missing_comma.rs │ │ ├── msg_send_missing_comma.stderr │ │ ├── msg_send_mutable.rs │ │ ├── msg_send_mutable.stderr │ │ ├── msg_send_no_return_type.rs │ │ ├── msg_send_no_return_type.stderr │ │ ├── msg_send_not_allowed_mutable.rs │ │ ├── msg_send_not_allowed_mutable.stderr │ │ ├── msg_send_not_encode.rs │ │ ├── msg_send_not_encode.stderr │ │ ├── msg_send_only_message.rs │ │ ├── msg_send_only_message.stderr │ │ ├── msg_send_special_selectors.rs │ │ ├── msg_send_special_selectors.stderr │ │ ├── msg_send_super_not_classtype.rs │ │ ├── msg_send_super_not_classtype.stderr │ │ ├── msg_send_underspecified.rs │ │ ├── msg_send_underspecified.stderr │ │ ├── msg_send_underspecified_error.rs │ │ ├── msg_send_underspecified_error.stderr │ │ ├── msg_send_underspecified_error1.rs │ │ ├── msg_send_underspecified_error1.stderr │ │ ├── msg_send_underspecified_error2.rs │ │ ├── msg_send_underspecified_error2.stderr │ │ ├── msg_send_underspecified_error3.rs │ │ ├── msg_send_underspecified_error3.stderr │ │ ├── msg_send_unwrap.rs │ │ ├── msg_send_unwrap.stderr │ │ ├── not_encode.rs │ │ ├── not_encode.stderr │ │ ├── not_writeback.rs │ │ ├── not_writeback.stderr │ │ ├── ns_copying_without_copy_helper.rs │ │ ├── ns_copying_without_copy_helper.stderr │ │ ├── ns_string_not_const.rs │ │ ├── ns_string_not_const.stderr │ │ ├── ns_string_output_not_const.rs │ │ ├── ns_string_output_not_const.stderr │ │ ├── nsarray_bound_not_send_sync.rs │ │ ├── nsarray_bound_not_send_sync.stderr │ │ ├── nsarray_not_message.rs │ │ ├── nsarray_not_message.stderr │ │ ├── nsobject_not_derefmut.rs │ │ ├── nsobject_not_derefmut.stderr │ │ ├── nsstring_as_str_use_after_release.rs │ │ ├── nsstring_as_str_use_after_release.stderr │ │ ├── nsstring_as_str_use_outside_pool.rs │ │ ├── nsstring_as_str_use_outside_pool.stderr │ │ ├── object_not_send_sync.rs │ │ ├── object_not_send_sync.stderr │ │ ├── protocol_object_only_protocols.rs │ │ ├── protocol_object_only_protocols.stderr │ │ ├── stack_block_requires_clone.rs │ │ ├── stack_block_requires_clone.stderr │ │ ├── stack_block_with_encoding_requires_clone.rs │ │ ├── stack_block_with_encoding_requires_clone.stderr │ │ ├── thread_kind_traits_unimplementable.rs │ │ ├── thread_kind_traits_unimplementable.stderr │ │ ├── thread_kind_traits_unimplementable2.rs │ │ ├── thread_kind_traits_unimplementable2.stderr │ │ ├── wrong_optional.rs │ │ └── wrong_optional.stderr └── tests │ ├── Cargo.toml │ ├── build.rs │ ├── compat-headers │ ├── gnustep-pre-2-0 │ │ ├── Block.h │ │ └── Block_private.h │ └── objfw │ │ ├── Block.h │ │ └── objc │ │ ├── objc.h │ │ └── runtime.h │ ├── extern │ ├── block_utils.c │ ├── encode_utils.m │ ├── test_object.m │ └── test_simd_return.m │ └── src │ ├── block.rs │ ├── exception.rs │ ├── lib.rs │ ├── rc_test_object.rs │ ├── test_define_class_protocol.rs │ ├── test_encode_utils.rs │ ├── test_foundation_retain_semantics.rs │ ├── test_object.rs │ └── test_simd_return.rs ├── examples ├── README.md ├── app │ ├── Cargo.toml │ └── delegate.rs ├── audio │ ├── Cargo.toml │ └── speech_synthesis.rs ├── corefoundation │ ├── Cargo.toml │ └── runloop.rs ├── metal │ ├── Cargo.toml │ └── triangle │ │ ├── main.rs │ │ └── triangle.metal ├── pasteboard │ ├── Cargo.toml │ └── nspasteboard.rs └── webkit │ ├── Cargo.toml │ └── browser.rs ├── framework-crates ├── .gitattributes ├── CHANGELOG.md ├── objc2-accessibility │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-accessory-setup-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-accounts │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-ad-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-ad-support │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-app-clip │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-app-kit │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── application.rs │ │ ├── event.rs │ │ ├── generated │ │ ├── image.rs │ │ ├── lib.rs │ │ └── text.rs │ └── translation-config.toml ├── objc2-app-tracking-transparency │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-application-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-ar-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-audio-toolbox │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-authentication-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-automatic-assessment-configuration │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-automator │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-av-foundation │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-av-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-av-routing │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-avf-audio │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-background-assets │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-background-tasks │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-browser-engine-core │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── memory.rs │ ├── tests │ │ ├── memory.rs │ │ └── memory │ │ │ ├── .gitattributes │ │ │ ├── use_c.c │ │ │ ├── use_c.ll │ │ │ ├── use_c.s │ │ │ ├── use_rs.ll │ │ │ ├── use_rs.rs │ │ │ └── use_rs.s │ └── translation-config.toml ├── objc2-browser-engine-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-business-chat │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-call-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-car-play │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-carbon │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-cf-network │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-cinematic │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ ├── tests │ │ ├── invalid_class.rs │ │ └── mutable_copying.rs │ └── translation-config.toml ├── objc2-class-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-clock-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-cloud-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-collaboration │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-color-sync │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-compositor-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-contacts-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-contacts │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-audio-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── view_controller.rs │ └── translation-config.toml ├── objc2-core-audio-types │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── session.rs │ └── translation-config.toml ├── objc2-core-audio │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-bluetooth │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-data │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-foundation │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── __cf_macro_helpers.rs │ │ ├── array.rs │ │ ├── base.rs │ │ ├── bundle.rs │ │ ├── cf_type.rs │ │ ├── data.rs │ │ ├── date.rs │ │ ├── dictionary.rs │ │ ├── error.rs │ │ ├── filedescriptor.rs │ │ ├── generated │ │ ├── geometry.rs │ │ ├── lib.rs │ │ ├── number.rs │ │ ├── opaque.rs │ │ ├── retained.rs │ │ ├── retained │ │ │ └── forwarding_impls.rs │ │ ├── string.rs │ │ ├── thread_safety.rs │ │ ├── timezone.rs │ │ ├── type_traits.rs │ │ ├── url.rs │ │ ├── user_notification.rs │ │ └── uuid.rs │ └── translation-config.toml ├── objc2-core-graphics │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── image.rs │ │ ├── lib.rs │ │ └── thread_safety.rs │ └── translation-config.toml ├── objc2-core-haptics │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-image │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-location-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-location │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-media-io │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-media │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── base.rs │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-midi │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-ml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-motion │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-nfc │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── files.rs │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-spotlight │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ ├── tests │ │ └── attribute_set.rs │ └── translation-config.toml ├── objc2-core-telephony │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-text │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── thread_safety.rs │ └── translation-config.toml ├── objc2-core-video │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-core-wlan │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-crypto-token-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-data-detection │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-device-check │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-device-discovery-extension │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-disk-arbitration │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-event-kit-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-event-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-exception-handling │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-execution-policy │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-exposure-notification │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-extension-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-external-accessory │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-file-provider-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-file-provider │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-finder-sync │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-foundation │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── __ns_macro_helpers │ │ │ ├── cached.rs │ │ │ ├── mod.rs │ │ │ └── ns_string.rs │ │ ├── array.rs │ │ ├── attributed_string.rs │ │ ├── bundle.rs │ │ ├── comparison_result.rs │ │ ├── copying.rs │ │ ├── data.rs │ │ ├── decimal.rs │ │ ├── dictionary.rs │ │ ├── enumerator.rs │ │ ├── error.rs │ │ ├── exception.rs │ │ ├── fast_enumeration_state.rs │ │ ├── generated │ │ ├── geometry.rs │ │ ├── iter.rs │ │ ├── lib.rs │ │ ├── macros │ │ │ ├── mod.rs │ │ │ └── ns_string.rs │ │ ├── ns_consumed.rs │ │ ├── number.rs │ │ ├── process_info.rs │ │ ├── range.rs │ │ ├── set.rs │ │ ├── string.rs │ │ ├── tests │ │ │ ├── array.rs │ │ │ ├── attributed_string.rs │ │ │ ├── auto_traits.rs │ │ │ ├── bundle.rs │ │ │ ├── copying.rs │ │ │ ├── data.rs │ │ │ ├── decimal_number.rs │ │ │ ├── dictionary.rs │ │ │ ├── error.rs │ │ │ ├── exception.rs │ │ │ ├── lock.rs │ │ │ ├── mod.rs │ │ │ ├── mutable_array.rs │ │ │ ├── mutable_data.rs │ │ │ ├── mutable_dictionary.rs │ │ │ ├── mutable_set.rs │ │ │ ├── mutable_string.rs │ │ │ ├── number.rs │ │ │ ├── process_info.rs │ │ │ ├── proxy.rs │ │ │ ├── set.rs │ │ │ ├── string.rs │ │ │ ├── task.rs │ │ │ ├── thread.rs │ │ │ ├── uuid.rs │ │ │ └── value.rs │ │ ├── thread.rs │ │ ├── to_owned.rs │ │ ├── url.rs │ │ ├── util.rs │ │ ├── uuid.rs │ │ └── value.rs │ ├── tests │ │ └── glob_import.rs │ └── translation-config.toml ├── objc2-fs-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-game-controller │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── input_names.rs │ │ └── lib.rs │ └── translation-config.toml ├── objc2-game-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-gameplay-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-health-kit-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-health-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-home-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-identity-lookup-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-identity-lookup │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-image-capture-core │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-image-io │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-input-method-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-intents-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-intents │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-io-bluetooth-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-io-bluetooth │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── macros.rs │ └── translation-config.toml ├── objc2-io-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── consumes_argument.rs │ │ ├── generated │ │ ├── lib.rs │ │ └── macros.rs │ └── translation-config.toml ├── objc2-io-surface │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── io_surface.rs │ │ └── lib.rs │ └── translation-config.toml ├── objc2-io-usb-host │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-itunes-library │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-javascript-core │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-latent-semantic-mapping │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-link-presentation │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-local-authentication-embedded-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-local-authentication │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-mail-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-map-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-media-accessibility │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-media-extension │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-media-player │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-media-setup │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-media-toolbox │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-message-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-messages │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-metal-fx │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-metal-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-metal-performance-shaders-graph │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-metal-performance-shaders │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── packed.rs │ └── translation-config.toml ├── objc2-metal │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── capture.rs │ │ ├── counters.rs │ │ ├── device.rs │ │ ├── generated │ │ ├── lib.rs │ │ ├── packed.rs │ │ ├── private.rs │ │ ├── rasterization_rate.rs │ │ ├── resource.rs │ │ ├── slice.rs │ │ ├── texture.rs │ │ └── types.rs │ ├── tests │ │ ├── null_error_handling.rs │ │ └── runs_with_core_graphics.rs │ └── translation-config.toml ├── objc2-metric-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── manager.rs │ └── translation-config.toml ├── objc2-ml-compute │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ ├── tests │ │ └── tensor.rs │ └── translation-config.toml ├── objc2-model-io │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-multipeer-connectivity │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-natural-language │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-nearby-interaction │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-network-extension │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-notification-center │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-open-directory │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-os-log │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-osa-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-paravirtualized-graphics │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-pass-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-pdf-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-pencil-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-phase │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-photos-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-photos │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-preference-panes │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-push-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-push-to-talk │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-quartz-core │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-quartz │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-quick-look-thumbnailing │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-quick-look-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-quick-look │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-replay-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-safari-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-safety-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-scene-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-screen-capture-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-screen-saver │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-screen-time │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-scripting-bridge │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-security-foundation │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-security-interface │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-security │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── authorization.rs │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-sensitive-content-analysis │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-sensor-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-service-management │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-shared-with-you-core │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-shared-with-you │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-shazam-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-social │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-sound-analysis │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-speech │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-sprite-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-store-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-symbols │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-system-configuration │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-system-extensions │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-thread-network │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-tv-ml-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-tv-services │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-tv-ui-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-ui-kit │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── application.rs │ │ ├── generated │ │ ├── gesture_recognizer.rs │ │ ├── lib.rs │ │ ├── paste_configuration.rs │ │ ├── responder.rs │ │ ├── tests │ │ │ ├── device.rs │ │ │ └── mod.rs │ │ └── text.rs │ └── translation-config.toml ├── objc2-uniform-type-identifiers │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-user-notifications-ui │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-user-notifications │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-video-subscriber-account │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-video-toolbox │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-virtualization │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-vision │ ├── Cargo.modified.toml │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ ├── lib.rs │ │ └── observation.rs │ └── translation-config.toml ├── objc2-watch-connectivity │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml ├── objc2-watch-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── application.rs │ │ ├── generated │ │ └── lib.rs │ └── translation-config.toml └── objc2-web-kit │ ├── Cargo.toml │ ├── README.md │ ├── src │ ├── generated │ └── lib.rs │ └── translation-config.toml ├── rust-toolchain.toml └── rustfmt.toml /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | 3 | # We include lock files in the repository, since: 4 | # - It helps CI. 5 | # - Though they're not published, we maintain binaries. 6 | # - We'd like to be aware of `trybuild` upgrades. 7 | # Cargo.lock 8 | 9 | tests-ios/* 10 | !tests-ios/prelude.rs 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "generated"] 2 | path = generated 3 | url = https://github.com/madsmtm/objc2-generated.git 4 | # We recommend a shallow clone here since there are a lot of generated 5 | # files in history, and I suspect most contributors won't need to look at 6 | # the history of these. 7 | shallow = true 8 | -------------------------------------------------------------------------------- /assets/design-files.kra: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/assets/design-files.kra -------------------------------------------------------------------------------- /assets/github-social-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/assets/github-social-preview.png -------------------------------------------------------------------------------- /assets/logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/assets/logo-small.png -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/assets/logo.png -------------------------------------------------------------------------------- /crates/block2/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "block" 2 | crate = "block2" 3 | required-crates = ["objc2"] 4 | link = false 5 | skipped = true 6 | is-library = true 7 | 8 | macos = "10.6" 9 | maccatalyst = "13.0" 10 | ios = "3.2" 11 | tvos = "9.0" 12 | watchos = "2.0" 13 | visionos = "1.0" 14 | gnustep = true 15 | -------------------------------------------------------------------------------- /crates/dispatch2/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.3.0" # Remember to update html_root_url in lib.rs 3 | description = "Bindings and wrappers for Apple's Grand Central Dispatch (GCD)" 4 | keywords = ["gcd", "macos", "ios", "dispatch", "libdispatch"] 5 | authors = ["Mads Marquart ", "Mary "] 6 | 7 | [dev-dependencies] 8 | static_assertions = "1.1.0" 9 | 10 | [package.metadata.release] 11 | shared-version = false 12 | tag-prefix = "dispatch2" 13 | -------------------------------------------------------------------------------- /crates/dispatch2/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Dispatch -------------------------------------------------------------------------------- /crates/dispatch2/src/retained/forwarding_impls.rs: -------------------------------------------------------------------------------- 1 | ../../../../crates/objc2/src/rc/retained_forwarding_impls.rs -------------------------------------------------------------------------------- /crates/dispatch2/src/utils.rs: -------------------------------------------------------------------------------- 1 | use alloc::boxed::Box; 2 | use core::ffi::c_void; 3 | 4 | pub(crate) extern "C" fn function_wrapper(work_boxed: *mut c_void) 5 | where 6 | F: FnOnce(), 7 | { 8 | // Safety: we reconstruct from a Box. 9 | let work = unsafe { Box::from_raw(work_boxed.cast::()) }; 10 | 11 | (*work)(); 12 | } 13 | -------------------------------------------------------------------------------- /crates/header-translator/configs/bitflags.toml: -------------------------------------------------------------------------------- 1 | framework = "__bitflags__" 2 | crate = "bitflags" 3 | required-crates = [] 4 | link = false 5 | skipped = true 6 | is-library = true 7 | 8 | # Available everywhere 9 | macos = "10.0" 10 | maccatalyst = "13.0" 11 | ios = "2.0" 12 | tvos = "9.0" 13 | watchos = "2.0" 14 | visionos = "1.0" 15 | gnustep = true 16 | -------------------------------------------------------------------------------- /crates/header-translator/configs/builtin.toml: -------------------------------------------------------------------------------- 1 | framework = "__builtin__" 2 | crate = "__builtin__" 3 | required-crates = [] 4 | link = false 5 | skipped = true 6 | 7 | # Available everywhere 8 | macos = "10.0" 9 | maccatalyst = "13.0" 10 | ios = "2.0" 11 | tvos = "9.0" 12 | watchos = "2.0" 13 | visionos = "1.0" 14 | gnustep = true 15 | -------------------------------------------------------------------------------- /crates/header-translator/configs/core.toml: -------------------------------------------------------------------------------- 1 | framework = "__core__" 2 | crate = "core" 3 | required-crates = [] 4 | link = false 5 | skipped = true 6 | 7 | # Available everywhere 8 | macos = "10.0" 9 | maccatalyst = "13.0" 10 | ios = "2.0" 11 | tvos = "9.0" 12 | watchos = "2.0" 13 | visionos = "1.0" 14 | gnustep = true 15 | -------------------------------------------------------------------------------- /crates/header-translator/configs/libc.toml: -------------------------------------------------------------------------------- 1 | framework = "__libc__" 2 | crate = "libc" 3 | required-crates = [] 4 | link = false 5 | skipped = true 6 | is-library = true 7 | 8 | # Available everywhere 9 | macos = "10.0" 10 | maccatalyst = "13.0" 11 | ios = "2.0" 12 | tvos = "9.0" 13 | watchos = "2.0" 14 | visionos = "1.0" 15 | gnustep = true 16 | 17 | # HACK: Define `task_port_t` in the using crate (it's a simple alias to `task_t`). 18 | external.task_port_t.module = "__builtin__" 19 | -------------------------------------------------------------------------------- /crates/objc2/src/ffi/selector.rs: -------------------------------------------------------------------------------- 1 | use core::ffi::c_char; 2 | 3 | use crate::runtime::{Bool, Sel}; 4 | 5 | extern_c! { 6 | pub fn sel_getName(sel: Sel) -> *const c_char; 7 | pub fn sel_isEqual(lhs: Sel, rhs: Sel) -> Bool; 8 | pub fn sel_registerName(name: *const c_char) -> Option; 9 | 10 | #[cfg(any(doc, not(feature = "unstable-objfw")))] 11 | pub fn sel_getUid(name: *const c_char) -> Option; 12 | 13 | #[cfg(any(doc, target_vendor = "apple"))] 14 | pub fn sel_isMapped(sel: Sel) -> Bool; 15 | } 16 | -------------------------------------------------------------------------------- /crates/objc2/src/macros/__fallback.rs: -------------------------------------------------------------------------------- 1 | #[doc(hidden)] 2 | #[macro_export] 3 | macro_rules! __fallback_if_not_set { 4 | ( 5 | () 6 | ($($fallback:tt)*) 7 | ) => { 8 | $($fallback)* 9 | }; 10 | ( 11 | ($($actual:tt)+) 12 | ($($_fallback:tt)*) 13 | ) => { 14 | $($actual)+ 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /crates/objc2/src/topics/about_generated/list.rs: -------------------------------------------------------------------------------- 1 | //! # List of framework crates 2 | //! 3 | //! The following is a full list of all supported Apple frameworks, and the 4 | //! corresponding Rust crate. 5 | //! 6 | #![doc = include_str!("list_data.md")] 7 | //! 8 | //! ## Unsupported 9 | //! 10 | //! Unsupported frameworks are listed below, feel free to [open an issue] if a 11 | //! framework that you need isn't supported, or if you disagree with the given 12 | //! reasoning. 13 | //! 14 | //! [open an issue]: https://github.com/madsmtm/objc2/issues/new 15 | //! 16 | #![doc = include_str!("list_unsupported.md")] 17 | -------------------------------------------------------------------------------- /crates/objc2/src/topics/about_generated/mod.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("README.md")] 2 | 3 | #[doc = include_str!("deref.md")] 4 | pub mod deref {} 5 | 6 | pub mod list; 7 | 8 | #[doc = include_str!("CHANGELOG.md")] 9 | pub mod changelog {} 10 | 11 | #[doc = include_str!("cargo_features.md")] 12 | pub mod cargo_features {} 13 | -------------------------------------------------------------------------------- /crates/objc2/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ObjectiveC" 2 | crate = "objc2" 3 | required-crates = [] 4 | link = false 5 | skipped = true 6 | is-library = true 7 | 8 | macos = "10.0" 9 | maccatalyst = "13.0" 10 | ios = "2.0" 11 | tvos = "9.0" 12 | watchos = "2.0" 13 | visionos = "1.0" 14 | gnustep = true 15 | 16 | # Both a protocol and a class, so we use Swift's naming scheme 17 | protocol.NSObject.renamed = "NSObjectProtocol" 18 | 19 | # Return type `oneway void` 20 | class.NSObject.methods.release.skipped = true 21 | -------------------------------------------------------------------------------- /crates/test-assembly/.gitattributes: -------------------------------------------------------------------------------- 1 | *.s linguist-generated 2 | -------------------------------------------------------------------------------- /crates/test-assembly/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-assembly" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | repository.workspace = true 7 | license.workspace = true 8 | 9 | build = "build.rs" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | cargo_metadata = "0.19" 16 | rustc-demangle = "0.1" 17 | regex = "1.6" 18 | lazy_static = "1.4.0" 19 | 20 | [package.metadata.release] 21 | release = false 22 | -------------------------------------------------------------------------------- /crates/test-assembly/build.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | fn main() { 4 | println!("cargo:rerun-if-changed=build.rs"); 5 | println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap()); 6 | } 7 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_autorelease_return" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/expected/apple-aarch64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .globl _simple 3 | .p2align 2 4 | _simple: 5 | b _objc_autoreleaseReturnValue 6 | 7 | .globl _with_body 8 | .p2align 2 9 | _with_body: 10 | stp x29, x30, [sp, #-16]! 11 | mov x29, sp 12 | bl _objc_msgSend 13 | ldp x29, x30, [sp], #16 14 | b _objc_autoreleaseReturnValue 15 | 16 | .subsections_via_symbols 17 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7s.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .section __TEXT,__text,regular,pure_instructions 3 | .globl _simple 4 | .p2align 2 5 | .code 32 6 | _simple: 7 | push {r7, lr} 8 | mov r7, sp 9 | pop {r7, lr} 10 | b _objc_autoreleaseReturnValue 11 | 12 | .globl _with_body 13 | .p2align 2 14 | .code 32 15 | _with_body: 16 | push {r7, lr} 17 | mov r7, sp 18 | bl _objc_msgSend 19 | pop {r7, lr} 20 | b _objc_autoreleaseReturnValue 21 | 22 | .subsections_via_symbols 23 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/expected/apple-x86.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .globl _simple 4 | .p2align 4 5 | _simple: 6 | push ebp 7 | mov ebp, esp 8 | pop ebp 9 | jmp _objc_autoreleaseReturnValue 10 | 11 | .globl _with_body 12 | .p2align 4 13 | _with_body: 14 | push ebp 15 | mov ebp, esp 16 | sub esp, 8 17 | mov eax, dword ptr [ebp + 8] 18 | mov ecx, dword ptr [ebp + 12] 19 | mov dword ptr [esp + 4], ecx 20 | mov dword ptr [esp], eax 21 | call _objc_msgSend 22 | mov dword ptr [esp], eax 23 | call _objc_autoreleaseReturnValue 24 | add esp, 8 25 | pop ebp 26 | ret 27 | 28 | .subsections_via_symbols 29 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/expected/apple-x86_64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .globl _simple 4 | .p2align 4 5 | _simple: 6 | push rbp 7 | mov rbp, rsp 8 | pop rbp 9 | jmp _objc_autoreleaseReturnValue 10 | 11 | .globl _with_body 12 | .p2align 4 13 | _with_body: 14 | push rbp 15 | mov rbp, rsp 16 | call _objc_msgSend 17 | mov rdi, rax 18 | pop rbp 19 | jmp _objc_autoreleaseReturnValue 20 | 21 | .subsections_via_symbols 22 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_autorelease_return/lib.rs: -------------------------------------------------------------------------------- 1 | //! Test that `Retained::autorelease_return` is tail-called properly. 2 | 3 | use objc2::__macro_helpers::{MsgSend, NewFamily}; 4 | use objc2::rc::Retained; 5 | use objc2::runtime::{AnyClass, AnyObject, Sel}; 6 | 7 | #[no_mangle] 8 | fn simple(obj: Retained) -> *mut AnyObject { 9 | Retained::autorelease_return(obj) 10 | } 11 | 12 | #[no_mangle] 13 | unsafe fn with_body(cls: &AnyClass, sel: Sel) -> *mut AnyObject { 14 | let obj: Option> = NewFamily::send_message(cls, sel, ()); 15 | Retained::autorelease_return(obj.unwrap_unchecked()) 16 | } 17 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_available/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_available" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_block/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_block" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | block2 = { path = "../../../block2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["block2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "block2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "block2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "block2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "block2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_block/expected/apple-armv7s.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .subsections_via_symbols 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_block/expected/apple-x86.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .subsections_via_symbols 4 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_block/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_block/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_define_class/expected/apple-armv7s.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .subsections_via_symbols 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_define_class/expected/apple-old-x86.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .subsections_via_symbols 4 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_define_class/expected/apple-x86.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .subsections_via_symbols 4 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_define_class/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_define_class/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_extern_protocol/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_extern_protocol/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_error/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_msg_send_error" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_retained/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_msg_send_retained" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_static_sel/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_static_sel/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_zero_cost/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_msg_send_zero_cost" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-aarch64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .globl _handle 3 | .p2align 2 4 | _handle: 5 | b _objc_msgSend 6 | 7 | .globl _handle_with_sel 8 | .p2align 2 9 | _handle_with_sel: 10 | Lloh0: 11 | adrp x8, _SEL_REF@PAGE 12 | Lloh1: 13 | ldr x1, [x8, _SEL_REF@PAGEOFF] 14 | b _objc_msgSend 15 | .loh AdrpLdr Lloh0, Lloh1 16 | 17 | .section __TEXT,__const 18 | .globl _SEL 19 | _SEL: 20 | .asciz "someSelector" 21 | 22 | .section __DATA,__const 23 | .globl _SEL_REF 24 | .p2align 3, 0x0 25 | _SEL_REF: 26 | .quad _SEL 27 | 28 | .subsections_via_symbols 29 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-x86_64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .globl _handle 4 | .p2align 4 5 | _handle: 6 | push rbp 7 | mov rbp, rsp 8 | pop rbp 9 | jmp _objc_msgSend 10 | 11 | .globl _handle_with_sel 12 | .p2align 4 13 | _handle_with_sel: 14 | push rbp 15 | mov rbp, rsp 16 | mov rsi, qword ptr [rip + _SEL_REF] 17 | pop rbp 18 | jmp _objc_msgSend 19 | 20 | .section __TEXT,__const 21 | .globl _SEL 22 | _SEL: 23 | .asciz "someSelector" 24 | 25 | .section __DATA,__const 26 | .globl _SEL_REF 27 | .p2align 3, 0x0 28 | _SEL_REF: 29 | .quad _SEL 30 | 31 | .subsections_via_symbols 32 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_out_parameters/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_out_parameters" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_retain_autoreleased" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | publish = false 6 | 7 | [lib] 8 | path = "lib.rs" 9 | 10 | [dependencies] 11 | objc2 = { path = "../../../objc2" } 12 | 13 | [features] 14 | # Runtime 15 | gnustep-1-7 = ["objc2/gnustep-1-7"] 16 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] 17 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] 18 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] 19 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] 20 | 21 | # Hack 22 | assembly-features = [] 23 | 24 | [package.metadata.release] 25 | release = false 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/expected/apple-aarch64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .globl _handle 3 | .p2align 2 4 | _handle: 5 | stp x29, x30, [sp, #-16]! 6 | mov x29, sp 7 | bl _objc_msgSend 8 | ; InlineAsm Start 9 | mov x29, x29 10 | ; InlineAsm End 11 | ldp x29, x30, [sp], #16 12 | b _objc_retainAutoreleasedReturnValue 13 | 14 | .subsections_via_symbols 15 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7s.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .section __TEXT,__text,regular,pure_instructions 3 | .globl _handle 4 | .p2align 2 5 | .code 32 6 | _handle: 7 | push {r7, lr} 8 | mov r7, sp 9 | bl _objc_msgSend 10 | @ InlineAsm Start 11 | mov r7, r7 12 | @ InlineAsm End 13 | pop {r7, lr} 14 | b _objc_retainAutoreleasedReturnValue 15 | 16 | .subsections_via_symbols 17 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/expected/apple-x86.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .globl _handle 4 | .p2align 4 5 | _handle: 6 | push ebp 7 | mov ebp, esp 8 | sub esp, 8 9 | mov eax, dword ptr [ebp + 8] 10 | mov ecx, dword ptr [ebp + 12] 11 | mov dword ptr [esp + 4], ecx 12 | mov dword ptr [esp], eax 13 | call _objc_msgSend 14 | ## InlineAsm Start 15 | 16 | mov ebp, ebp 17 | 18 | ## InlineAsm End 19 | mov dword ptr [esp], eax 20 | call _objc_retainAutoreleasedReturnValue 21 | add esp, 8 22 | pop ebp 23 | ret 24 | 25 | .subsections_via_symbols 26 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/expected/apple-x86_64.s: -------------------------------------------------------------------------------- 1 | .section __TEXT,__text,regular,pure_instructions 2 | .intel_syntax noprefix 3 | .globl _handle 4 | .p2align 4 5 | _handle: 6 | push rbp 7 | mov rbp, rsp 8 | call _objc_msgSend 9 | mov rdi, rax 10 | call _objc_retainAutoreleasedReturnValue 11 | ## InlineAsm Start 12 | 13 | nop 14 | 15 | ## InlineAsm End 16 | pop rbp 17 | ret 18 | 19 | .subsections_via_symbols 20 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section .text.handle,"ax",@progbits 3 | .globl handle 4 | .p2align 4 5 | .type handle,@function 6 | handle: 7 | push r14 8 | push rbx 9 | push rax 10 | mov rbx, rsi 11 | mov r14, rdi 12 | call qword ptr [rip + objc_msg_lookup@GOTPCREL] 13 | mov rdi, r14 14 | mov rsi, rbx 15 | call rax 16 | mov rdi, rax 17 | add rsp, 8 18 | pop rbx 19 | pop r14 20 | jmp qword ptr [rip + objc_retainAutoreleasedReturnValue@GOTPCREL] 21 | .Lfunc_end0: 22 | .size handle, .Lfunc_end0-handle 23 | 24 | .section ".note.GNU-stack","",@progbits 25 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_retain_autoreleased/lib.rs: -------------------------------------------------------------------------------- 1 | //! Test that `Retained::retain_autoreleased` is inlined properly. 2 | 3 | use objc2::rc::Retained; 4 | use objc2::runtime::{AnyObject, MessageReceiver, Sel}; 5 | 6 | #[no_mangle] 7 | unsafe fn handle(obj: &AnyObject, sel: Sel) -> Option> { 8 | let ptr: *mut AnyObject = MessageReceiver::send_message(obj, sel, ()); 9 | Retained::retain_autoreleased(ptr) 10 | } 11 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_static_sel/expected/gnustep-x86.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-assembly/crates/test_static_sel/expected/gnustep-x86_64.s: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .section ".note.GNU-stack","",@progbits 3 | -------------------------------------------------------------------------------- /crates/test-frameworks/.gitignore: -------------------------------------------------------------------------------- 1 | # Test files here are not kept in Git, since the difference 2 | # between / evolution of them are not really important. 3 | tests/* 4 | src/imports.rs 5 | !.gitkeep 6 | -------------------------------------------------------------------------------- /crates/test-frameworks/README.md: -------------------------------------------------------------------------------- 1 | # Auto-generated tests for framework crates. 2 | 3 | See the source of [`header-translator`](../header-translator) for how this is generated. 4 | 5 | Currently only tested in CI on macOS and Mac Catalyst. 6 | -------------------------------------------------------------------------------- /crates/test-frameworks/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/crates/test-frameworks/tests/.gitkeep -------------------------------------------------------------------------------- /crates/test-fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | artifacts/ 3 | coverage/ 4 | afl/ 5 | 6 | # The corpus generally grows very quickly, and doesn't really need to be in-tree 7 | corpus/ 8 | # However, we do want to keep it for classes and selectors 9 | !corpus/class/ 10 | !corpus/sel/ 11 | -------------------------------------------------------------------------------- /crates/test-fuzz/README.md: -------------------------------------------------------------------------------- 1 | # Fuzzing `objc2` 2 | 3 | Run using `cargo-fuzz` (note: you must specify the `--fuzz-dir` argument). 4 | 5 | ```sh 6 | cargo fuzz run --fuzz-dir=./crates/test-fuzz/ --features=fuzz-all $fuzz_target 7 | ``` 8 | 9 | ## Fuzzing with `afl` 10 | 11 | Fuzz with AFL++ by doing: 12 | 13 | (This is probably not the optimal settings, AFL has a lot of configuration options). 14 | 15 | ```sh 16 | cargo afl build --bin $fuzz_target --features=afl,fuzz-all --release 17 | cargo afl fuzz -i crates/test-fuzz/corpus/$fuzz_target -o crates/test-fuzz/afl -- target/release/$fuzz_target 18 | ``` 19 | -------------------------------------------------------------------------------- /crates/test-fuzz/afl/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/crates/test-fuzz/afl/.gitkeep -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/class/invalid_class: -------------------------------------------------------------------------------- 1 | N -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/class/nul_: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/class/other_class: -------------------------------------------------------------------------------- 1 | NSLock -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/class/root_class: -------------------------------------------------------------------------------- 1 | Object -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/class/unknown: -------------------------------------------------------------------------------- 1 | 2 | ****) -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/collection_interior_mut/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/crates/test-fuzz/corpus/collection_interior_mut/.gitkeep -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/encoding_parse/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/crates/test-fuzz/corpus/encoding_parse/.gitkeep -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/nsstring/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madsmtm/objc2/8123aba9a97656eb49b1f5360850c9fe9f0ab5cc/crates/test-fuzz/corpus/nsstring/.gitkeep -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/sel/longer: -------------------------------------------------------------------------------- 1 | xxxxxxx -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/sel/nul_: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/sel/simple: -------------------------------------------------------------------------------- 1 | x -------------------------------------------------------------------------------- /crates/test-fuzz/corpus/sel/with_colon: -------------------------------------------------------------------------------- 1 | some:selector: 2 | -------------------------------------------------------------------------------- /crates/test-fuzz/fuzz_targets/cfstring.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "afl"), no_main)] 2 | use objc2_core_foundation::CFString; 3 | 4 | fn run(s: &str) { 5 | let obj = CFString::from_str(s); 6 | assert_eq!(obj.to_string(), s); 7 | 8 | if let Some(efficient_lookup) = unsafe { obj.as_str_unchecked() } { 9 | assert_eq!(efficient_lookup, s); 10 | } 11 | } 12 | 13 | #[cfg(not(feature = "afl"))] 14 | libfuzzer_sys::fuzz_target!(|s: &str| run(s)); 15 | 16 | #[cfg(feature = "afl")] 17 | fn main() { 18 | afl::fuzz!(|s: &str| { 19 | run(s); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /crates/test-fuzz/fuzz_targets/nsstring.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "afl"), no_main)] 2 | use objc2::rc::autoreleasepool; 3 | use objc2_foundation::NSString; 4 | 5 | fn run(s: &str) { 6 | autoreleasepool(|pool| unsafe { 7 | let obj = NSString::from_str(s); 8 | assert_eq!(obj.to_str(pool), s); 9 | }); 10 | } 11 | 12 | #[cfg(not(feature = "afl"))] 13 | libfuzzer_sys::fuzz_target!(|s: &str| run(s)); 14 | 15 | #[cfg(feature = "afl")] 16 | fn main() { 17 | afl::fuzz!(|s: &str| { 18 | run(s); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /crates/test-fuzz/fuzz_targets/sel.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(feature = "afl"), no_main)] 2 | use objc2::runtime::Sel; 3 | use std::ffi::{CStr, CString}; 4 | 5 | #[allow(clippy::eq_op)] 6 | fn run(s: &CStr) { 7 | #[cfg(not(target_vendor = "apple"))] // GNUstep 8 | let _cls = ::class(); 9 | 10 | let sel = Sel::register(s); 11 | assert_eq!(s, sel.name()); 12 | assert_eq!(sel, sel); 13 | } 14 | 15 | #[cfg(not(feature = "afl"))] 16 | libfuzzer_sys::fuzz_target!(|s: CString| run(&s)); 17 | 18 | #[cfg(feature = "afl")] 19 | fn main() { 20 | afl::fuzz!(|s: CString| { 21 | run(&s); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /crates/test-ui/.gitattributes: -------------------------------------------------------------------------------- 1 | *.stderr linguist-generated 2 | -------------------------------------------------------------------------------- /crates/test-ui/src/hack.rs: -------------------------------------------------------------------------------- 1 | fn main() {} 2 | -------------------------------------------------------------------------------- /crates/test-ui/src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /crates/test-ui/ui/autoreleasepool_not_send_sync.rs: -------------------------------------------------------------------------------- 1 | //! Test that AutoreleasePool is not Send and Sync, because it internally 2 | //! works with thread locals. 3 | 4 | use objc2::rc::AutoreleasePool; 5 | 6 | fn needs_sync() {} 7 | fn needs_send() {} 8 | 9 | fn main() { 10 | needs_sync::>(); 11 | needs_send::>(); 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/available_invalid.rs: -------------------------------------------------------------------------------- 1 | //! Various invalid usage of the `available!` macro. 2 | use objc2::available; 3 | 4 | fn main() { 5 | // Space between version 6 | available!(macos = 1 1); 7 | 8 | // Various invalid syntax 9 | available!(macos = ABCD); 10 | available!(macos = ); 11 | available!(macos: 1.2); 12 | available!(macos); 13 | } 14 | -------------------------------------------------------------------------------- /crates/test-ui/ui/available_same_os.rs: -------------------------------------------------------------------------------- 1 | //! Same OS name repeated in the `available!` macro. 2 | use objc2::available; 3 | 4 | fn main() { 5 | available!(macos = 1.2, macos = 1.2); 6 | } 7 | -------------------------------------------------------------------------------- /crates/test-ui/ui/available_same_os.stderr: -------------------------------------------------------------------------------- 1 | error[E0062]: field `macos` specified more than once 2 | --> ui/available_same_os.rs 3 | | 4 | | available!(macos = 1.2, macos = 1.2); 5 | | ------------------------^^^^^------- 6 | | | | 7 | | | used more than once 8 | | first use of `macos` 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/available_unknown_os.rs: -------------------------------------------------------------------------------- 1 | //! Unknown OS name in `available!` macro. 2 | use objc2::available; 3 | 4 | fn main() { 5 | available!(unknown = 1.2); 6 | } 7 | -------------------------------------------------------------------------------- /crates/test-ui/ui/available_unknown_os.stderr: -------------------------------------------------------------------------------- 1 | error[E0560]: struct `AvailableVersion` has no field named `unknown` 2 | --> ui/available_unknown_os.rs 3 | | 4 | | available!(unknown = 1.2); 5 | | ^^^^^^^ `AvailableVersion` does not have this field 6 | | 7 | = note: all struct fields are already assigned 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/block_carrying_lifetime.rs: -------------------------------------------------------------------------------- 1 | use std::cell::OnceCell; 2 | use std::thread_local; 3 | 4 | use block2::{Block, RcBlock}; 5 | 6 | fn tries_to_retain_past_given_lifetime(block: &Block) { 7 | thread_local! { 8 | pub static BLOCK: OnceCell> = const { OnceCell::new() }; 9 | } 10 | BLOCK.with(|thread_local| { 11 | thread_local.set(block.copy()).unwrap(); 12 | }); 13 | } 14 | 15 | fn main() {} 16 | -------------------------------------------------------------------------------- /crates/test-ui/ui/block_parameter_lifetime.rs: -------------------------------------------------------------------------------- 1 | //! Test the implementation of `BlockFn` not being generic enough. 2 | //! 3 | //! This is a bug, but it is difficult to fix as we have to mark the lifetimes 4 | //! as higher-ranked in the trait implementation, so let's at least track the 5 | //! error message. 6 | use block2::Block; 7 | 8 | use objc2::encode::Encode; 9 | 10 | fn is_encode() {} 11 | 12 | fn main() { 13 | is_encode::<&Block>(); 14 | // is_encode::<&Block Fn() -> &'a i16>>(); 15 | is_encode::<&Block &i32>>(); 16 | is_encode::<&Block Fn(&'a i64, &'a i64) -> &'a i64>>(); 17 | } 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/cfstring_from_static_str.rs: -------------------------------------------------------------------------------- 1 | //! Test that a `'static` str used in `CFString` can't later be modified. 2 | use objc2_core_foundation::CFString; 3 | 4 | fn main() { 5 | // Create a `&'static mut str`. 6 | let s = String::from("xyz").leak(); 7 | 8 | // Construct a `CFString` from it. 9 | let cf = CFString::from_static_str(s); 10 | assert_eq!(cf.to_string(), "xyz"); 11 | 12 | // Modify the string. 13 | s.make_ascii_uppercase(); 14 | 15 | // This would be invalid, since CFString is expected to be immutable. 16 | assert_eq!(cf.to_string(), "XYZ"); 17 | } 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/cfstring_from_static_str.stderr: -------------------------------------------------------------------------------- 1 | error[E0502]: cannot borrow `*s` as mutable because it is also borrowed as immutable 2 | --> ui/cfstring_from_static_str.rs 3 | | 4 | | let cf = CFString::from_static_str(s); 5 | | ---------------------------- 6 | | | | 7 | | | immutable borrow occurs here 8 | | argument requires that `*s` is borrowed for `'static` 9 | ... 10 | | s.make_ascii_uppercase(); 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/define_class_invalid_type2.rs: -------------------------------------------------------------------------------- 1 | use objc2::define_class; 2 | use objc2::rc::{Allocated, Retained}; 3 | use objc2::runtime::NSObject; 4 | 5 | define_class!( 6 | #[unsafe(super(NSObject))] 7 | struct CustomObject; 8 | 9 | impl CustomObject { 10 | #[unsafe(method_id(initNotSameGenerics))] 11 | fn test_init_not_same_generics(this: Allocated) -> Retained { 12 | unimplemented!() 13 | } 14 | 15 | #[unsafe(method_id(notRetained))] 16 | fn test_not_retained(&self) -> i32 { 17 | unimplemented!() 18 | } 19 | } 20 | ); 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/test-ui/ui/downcast_generic.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::{NSArray, NSObject}; 2 | 3 | fn main() { 4 | let arr = NSArray::new(); 5 | 6 | // Possible 7 | let _ = arr.downcast::(); 8 | 9 | // Not possible 10 | let _ = arr.downcast::>(); 11 | } 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_duplicate.rs: -------------------------------------------------------------------------------- 1 | //! Test duplicate fields in extern_class! 2 | use objc2::runtime::NSObject; 3 | use objc2::{extern_class, MainThreadOnly}; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] 7 | #[unsafe(super(NSObject))] 8 | struct DuplicateSuper; 9 | ); 10 | 11 | extern_class!( 12 | #[unsafe(super(NSObject))] 13 | #[name = "Abc"] 14 | #[name = "Abc"] 15 | struct DuplicateName; 16 | ); 17 | 18 | extern_class!( 19 | #[unsafe(super(NSObject))] 20 | #[thread_kind = MainThreadOnly] 21 | #[thread_kind = MainThreadOnly] 22 | struct DuplicateThreadKind; 23 | ); 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_feature_flag.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, ClassType}; 3 | 4 | extern_class!( 5 | #[cfg(not(test))] 6 | #[unsafe(super(NSObject))] 7 | pub struct MyTestEnabled; 8 | ); 9 | 10 | extern_class!( 11 | #[cfg(test)] 12 | #[unsafe(super(NSObject))] 13 | pub struct MyTestDisabled; 14 | ); 15 | 16 | fn main() { 17 | let _cls = MyTestEnabled::class(); 18 | 19 | let _cls = MyTestDisabled::class(); 20 | } 21 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_feature_flag.stderr: -------------------------------------------------------------------------------- 1 | error[E0433]: failed to resolve: use of undeclared type `MyTestDisabled` 2 | --> ui/extern_class_feature_flag.rs 3 | | 4 | | let _cls = MyTestDisabled::class(); 5 | | ^^^^^^^^^^^^^^ 6 | | | 7 | | use of undeclared type `MyTestDisabled` 8 | | help: a struct with a similar name exists: `MyTestEnabled` 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_impls_drop.rs: -------------------------------------------------------------------------------- 1 | //! Test that implementing Drop for a class created with extern_class! fails. 2 | use objc2::extern_class; 3 | use objc2::runtime::NSObject; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] 7 | struct MyClass; 8 | ); 9 | 10 | impl Drop for MyClass { 11 | fn drop(&mut self) {} 12 | } 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_ivars.rs: -------------------------------------------------------------------------------- 1 | //! Test specifying #[ivars = ...] in extern_class! 2 | use objc2::extern_class; 3 | use objc2::runtime::NSObject; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] 7 | #[ivars = i32] 8 | struct IvarsEqual; 9 | ); 10 | 11 | fn main() {} 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_ivars.stderr: -------------------------------------------------------------------------------- 1 | error: #[ivars] is not supported in extern_class! 2 | --> ui/extern_class_ivars.rs 3 | | 4 | | / extern_class!( 5 | | | #[unsafe(super(NSObject))] 6 | | | #[ivars = i32] 7 | | | struct IvarsEqual; 8 | | | ); 9 | | |_^ 10 | | 11 | = note: this error originates in the macro `$crate::__extern_class_check_no_ivars` which comes from the expansion of the macro `extern_class` (in Nightly builds, run with -Z macro-backtrace for more info) 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_no_super.rs: -------------------------------------------------------------------------------- 1 | //! Test extern_class! without any superclasses. 2 | use objc2::{extern_class, MainThreadMarker, MainThreadOnly}; 3 | 4 | extern_class!( 5 | #[thread_kind = MainThreadOnly] 6 | #[name = "NSObject"] 7 | struct NoSuper; 8 | ); 9 | 10 | fn main() { 11 | let _ = NoSuper::alloc(MainThreadMarker::new().unwrap()); 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_no_super.stderr: -------------------------------------------------------------------------------- 1 | error: must specify the superclass with #[unsafe(super(...))] 2 | --> ui/extern_class_no_super.rs 3 | | 4 | | / extern_class!( 5 | | | #[thread_kind = MainThreadOnly] 6 | | | #[name = "NSObject"] 7 | | | struct NoSuper; 8 | | | ); 9 | | |_^ 10 | | 11 | = note: this error originates in the macro `$crate::__extern_class_check_super_unsafe` which comes from the expansion of the macro `extern_class` (in Nightly builds, run with -Z macro-backtrace for more info) 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_paren_attrs.rs: -------------------------------------------------------------------------------- 1 | //! Test using attributes with parentheses in extern_class! 2 | use objc2::extern_class; 3 | use objc2::runtime::NSObject; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] // Should succeed 7 | // But the rest should fail 8 | #[thread_kind(i32)] 9 | #[name(i32)] 10 | #[ivars(i32)] 11 | struct Parentheses; 12 | ); 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_paren_attrs.stderr: -------------------------------------------------------------------------------- 1 | error: cannot find attribute `thread_kind` in this scope 2 | --> ui/extern_class_paren_attrs.rs 3 | | 4 | | #[thread_kind(i32)] 5 | | ^^^^^^^^^^^ 6 | 7 | error: cannot find attribute `name` in this scope 8 | --> ui/extern_class_paren_attrs.rs 9 | | 10 | | #[name(i32)] 11 | | ^^^^ 12 | 13 | error: cannot find attribute `ivars` in this scope 14 | --> ui/extern_class_paren_attrs.rs 15 | | 16 | | #[ivars(i32)] 17 | | ^^^^^ 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_safe_super.rs: -------------------------------------------------------------------------------- 1 | //! Test extern_class! without `unsafe` in front of `super(...)` 2 | use objc2::extern_class; 3 | use objc2::runtime::NSObject; 4 | 5 | extern_class!( 6 | #[super(NSObject)] 7 | struct NoSuper; 8 | ); 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_safe_super.stderr: -------------------------------------------------------------------------------- 1 | error: #[super(...)] must be wrapped in `unsafe`, as in #[unsafe(super(...))] 2 | --> ui/extern_class_safe_super.rs 3 | | 4 | | / extern_class!( 5 | | | #[super(NSObject)] 6 | | | struct NoSuper; 7 | | | ); 8 | | |_^ 9 | | 10 | = note: this error originates in the macro `$crate::__extern_class_check_super_unsafe` which comes from the expansion of the macro `extern_class` (in Nightly builds, run with -Z macro-backtrace for more info) 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_subclass_object.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::AnyObject; 2 | use objc2::{extern_class, AnyThread}; 3 | 4 | extern_class!( 5 | #[unsafe(super(AnyObject))] 6 | #[thread_kind = AnyThread] 7 | pub struct MyRootClass; 8 | ); 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_thread_kind_invalid.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, ThreadKind}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | #[thread_kind = ThreadKind] 7 | struct BogusThreadKind; 8 | ); 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_thread_kind_main_send_sync.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, MainThreadOnly}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | #[thread_kind = MainThreadOnly] 7 | struct SendAndOnlyMain; 8 | ); 9 | 10 | unsafe impl Send for SendAndOnlyMain {} 11 | 12 | extern_class!( 13 | #[unsafe(super(NSObject))] 14 | #[thread_kind = MainThreadOnly] 15 | struct SyncAndOnlyMain; 16 | ); 17 | 18 | unsafe impl Sync for SyncAndOnlyMain {} 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_thread_kind_main_to_any.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, AnyThread, MainThreadOnly}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | #[thread_kind = MainThreadOnly] 7 | struct OnlyMain; 8 | ); 9 | 10 | extern_class!( 11 | #[unsafe(super(OnlyMain))] 12 | #[thread_kind = AnyThread] 13 | struct AnyThreadButSubclassesOnlyMain; 14 | ); 15 | 16 | fn main() {} 17 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_with_fields.rs: -------------------------------------------------------------------------------- 1 | //! Test that the syntax with fields doesn't work. 2 | //! 3 | //! If it does in the future, we have to make sure that the class is still a 4 | //! ZST. 5 | use objc2::extern_class; 6 | 7 | extern_class!( 8 | #[unsafe(super(objc2::runtime::NSObject))] 9 | pub struct NSNumber { 10 | var: u32, 11 | } 12 | ); 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_class_with_fields.stderr: -------------------------------------------------------------------------------- 1 | error: no rules expected `{` 2 | --> ui/extern_class_with_fields.rs 3 | | 4 | | pub struct NSNumber { 5 | | ^ no rules expected this token in macro call 6 | | 7 | note: while trying to match `;` 8 | --> $WORKSPACE/crates/objc2/src/macros/extern_class.rs 9 | | 10 | | $v:vis struct $class:ident; 11 | | ^ 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_deprecated.rs: -------------------------------------------------------------------------------- 1 | //! Test using deprecated `#[unsafe(method_id(...))]`. 2 | #![deny(warnings)] 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | use objc2::{extern_class, extern_methods}; 6 | 7 | extern_class!( 8 | #[unsafe(super(NSObject))] 9 | pub struct MyObject; 10 | ); 11 | 12 | impl MyObject { 13 | extern_methods!( 14 | #[unsafe(method_id(myMethod:))] 15 | fn my_method(param: i32) -> Retained; 16 | ); 17 | } 18 | 19 | fn main() {} 20 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_deprecated_syntax.rs: -------------------------------------------------------------------------------- 1 | //! Test extern_methods! syntax with `unsafe impl`. 2 | #![deny(deprecated)] 3 | use objc2::runtime::NSObject; 4 | use objc2::{extern_class, extern_methods}; 5 | 6 | extern_class!( 7 | #[unsafe(super(NSObject))] 8 | pub struct MyObject; 9 | ); 10 | 11 | extern_methods!( 12 | unsafe impl MyObject { 13 | #[unsafe(method(foo))] 14 | fn foo(); 15 | } 16 | ); 17 | 18 | fn main() {} 19 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_invalid_receiver.rs: -------------------------------------------------------------------------------- 1 | use objc2::rc::{Allocated, Retained}; 2 | use objc2::runtime::NSObject; 3 | use objc2::{extern_class, extern_methods}; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] 7 | pub struct MyObject; 8 | ); 9 | 10 | impl MyObject { 11 | extern_methods!( 12 | #[unsafe(method(initWithMut))] 13 | fn init_with_mut(&mut self) -> Option>; 14 | ); 15 | 16 | extern_methods!( 17 | #[unsafe(method(initWithOptionAllocated))] 18 | fn init_with_option_allocated(this: Option>) -> Option>; 19 | ); 20 | } 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_missing_method.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, extern_methods}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | pub struct MyObject; 7 | ); 8 | 9 | impl MyObject { 10 | extern_methods!( 11 | fn a(); 12 | ); 13 | } 14 | 15 | fn main() {} 16 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_missing_method.stderr: -------------------------------------------------------------------------------- 1 | error: must specify the desired selector using `#[unsafe(method(...))]` or `#[unsafe(method_id(...))]` 2 | --> ui/extern_methods_missing_method.rs 3 | | 4 | | / extern_methods!( 5 | | | fn a(); 6 | | | ); 7 | | |_____^ 8 | | 9 | = note: this error originates in the macro `$crate::__extract_method_attributes_inner` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_not_allowed_mutable.rs: -------------------------------------------------------------------------------- 1 | //! Test extern_methods! with mutable receivers. 2 | use objc2::rc::Retained; 3 | use objc2::runtime::NSObject; 4 | use objc2::{extern_class, extern_methods}; 5 | 6 | extern_class!( 7 | #[unsafe(super(NSObject))] 8 | pub struct MyObject; 9 | ); 10 | 11 | impl MyObject { 12 | extern_methods!( 13 | #[unsafe(method(test))] 14 | fn test(&mut self); 15 | ); 16 | } 17 | 18 | impl MyObject { 19 | extern_methods!( 20 | #[unsafe(method(testRetained))] 21 | fn test_retained(&mut self) -> Retained; 22 | ); 23 | } 24 | 25 | fn main() {} 26 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_not_unsafe.rs: -------------------------------------------------------------------------------- 1 | #![allow(deprecated)] 2 | use objc2::runtime::NSObject; 3 | use objc2::{extern_class, extern_methods}; 4 | 5 | extern_class!( 6 | #[unsafe(super(NSObject))] 7 | pub struct MyObject; 8 | ); 9 | 10 | impl MyObject { 11 | extern_methods!( 12 | #[method(foo)] 13 | fn method(); 14 | 15 | #[method_id(foo)] 16 | fn method_id(); 17 | ); 18 | } 19 | 20 | fn main() {} 21 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_outside_impl.rs: -------------------------------------------------------------------------------- 1 | use objc2::extern_methods; 2 | 3 | extern_methods!( 4 | #[unsafe(method(foo))] 5 | fn class_method(); 6 | ); 7 | 8 | extern_methods!( 9 | #[unsafe(method(foo))] 10 | fn instance_method(&self); 11 | ); 12 | 13 | fn main() {} 14 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_selector_twice.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | use objc2::{extern_class, extern_methods}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | pub struct MyObject; 7 | ); 8 | 9 | impl MyObject { 10 | extern_methods!( 11 | #[unsafe(method(foo))] 12 | #[unsafe(method(bar))] 13 | fn selector_twice(); 14 | ); 15 | } 16 | 17 | fn main() {} 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/extern_methods_selector_twice.stderr: -------------------------------------------------------------------------------- 1 | error: cannot specify the `method`/`method_id` attribute twice 2 | --> ui/extern_methods_selector_twice.rs 3 | | 4 | | / extern_methods!( 5 | | | #[unsafe(method(foo))] 6 | | | #[unsafe(method(bar))] 7 | | | fn selector_twice(); 8 | | | ); 9 | | |_____^ 10 | | 11 | = note: this error originates in the macro `$crate::__handle_duplicate` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/fn_ptr_reference_encode.rs: -------------------------------------------------------------------------------- 1 | //! Test that `Encode` is not implemented for function pointers that are 2 | //! higher-ranked over lifetimes. 3 | //! 4 | //! Ideally, it should be, but it can't right now. 5 | use objc2::encode::Encode; 6 | 7 | extern "C" fn my_fn(_x: &i32) {} 8 | 9 | fn impls_encode(_x: T) {} 10 | 11 | fn main() { 12 | // Works 13 | impls_encode(my_fn as extern "C" fn(_)); 14 | // Can't be written: 15 | // let encoding = ::ENCODING; 16 | 17 | // Fails 18 | impls_encode(my_fn as extern "C" fn(&i32)); 19 | let _encoding = ::ENCODING; 20 | } 21 | -------------------------------------------------------------------------------- /crates/test-ui/ui/global_block_args_covariant.stderr: -------------------------------------------------------------------------------- 1 | error[E0597]: `x` does not live long enough 2 | --> ui/global_block_args_covariant.rs 3 | | 4 | | let x = 5 + 2; 5 | | - binding `x` declared here 6 | | PUT_STATIC_IN_THREAD_LOCAL.call((&x,)); 7 | | ---------------------------------^^--- 8 | | | | 9 | | | borrowed value does not live long enough 10 | | argument requires that `x` is borrowed for `'static` 11 | | } 12 | | - `x` dropped here while still borrowed 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/global_block_not_encode.rs: -------------------------------------------------------------------------------- 1 | use block2::global_block; 2 | 3 | global_block! { 4 | pub static BLOCK = |_b: Box| {}; 5 | } 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/implement_protocol_missing_super.rs: -------------------------------------------------------------------------------- 1 | //! Test that implementing certain traits like `NSURLSessionDelegate` requires 2 | //! super protocols like `NSObjectProtocol` to also be implemented. 3 | use objc2::{define_class, MainThreadOnly}; 4 | use objc2_foundation::{NSObject, NSURLSessionDelegate}; 5 | 6 | define_class!( 7 | #[unsafe(super(NSObject))] 8 | #[thread_kind = MainThreadOnly] 9 | struct CustomObject; 10 | 11 | unsafe impl NSURLSessionDelegate for CustomObject {} 12 | ); 13 | 14 | fn main() {} 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_msg_send_super.rs: -------------------------------------------------------------------------------- 1 | //! Test invalid msg_send![super(...)] syntax 2 | use objc2::msg_send; 3 | use objc2::runtime::{AnyClass, NSObject}; 4 | 5 | fn main() { 6 | let obj: &NSObject; 7 | let superclass: &AnyClass; 8 | 9 | let _: () = unsafe { msg_send![super, init] }; 10 | let _: () = unsafe { msg_send![super(), init] }; 11 | let _: () = unsafe { msg_send![super(obj,), init] }; 12 | let _: () = unsafe { msg_send![super(obj, superclass,), init] }; 13 | } 14 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_ns_string_input.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::ns_string; 2 | 3 | fn main() { 4 | let _ = ns_string!(1u8); 5 | } 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_ns_string_input.stderr: -------------------------------------------------------------------------------- 1 | error[E0308]: mismatched types 2 | --> ui/invalid_ns_string_input.rs 3 | | 4 | | let _ = ns_string!(1u8); 5 | | ^^^ expected `&str`, found `u8` 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_ns_string_output.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::ns_string; 2 | 3 | fn main() { 4 | let _: u8 = ns_string!("abc"); 5 | } 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_ns_string_output.stderr: -------------------------------------------------------------------------------- 1 | error[E0308]: mismatched types 2 | --> ui/invalid_ns_string_output.rs 3 | | 4 | | let _: u8 = ns_string!("abc"); 5 | | ^^^^^^^^^^^^^^^^^ expected `u8`, found `&NSString` 6 | | 7 | = note: this error originates in the macro `$crate::__ns_string_inner` which comes from the expansion of the macro `ns_string` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_option_encode_impl.rs: -------------------------------------------------------------------------------- 1 | //! Ensure that implementing `OptionEncode` wrongly results in an error 2 | use objc2::encode::{Encode, Encoding, OptionEncode}; 3 | 4 | #[repr(transparent)] 5 | struct MyType(usize); 6 | 7 | unsafe impl Encode for MyType { 8 | const ENCODING: Encoding = usize::ENCODING; 9 | } 10 | 11 | unsafe impl OptionEncode for MyType {} 12 | 13 | fn main() { 14 | assert_eq!(>::ENCODING, MyType::ENCODING); 15 | } 16 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_option_encode_impl_ref.rs: -------------------------------------------------------------------------------- 1 | //! Ensure that implementing `OptionEncode` wrongly results in an error 2 | use objc2::encode::{Encoding, OptionEncode, RefEncode}; 3 | 4 | #[repr(transparent)] 5 | struct MyType(usize); 6 | 7 | unsafe impl RefEncode for MyType { 8 | const ENCODING_REF: Encoding = usize::ENCODING_REF; 9 | } 10 | 11 | unsafe impl OptionEncode for MyType {} 12 | 13 | fn main() { 14 | assert_eq!(>::ENCODING_REF, MyType::ENCODING_REF); 15 | } 16 | -------------------------------------------------------------------------------- /crates/test-ui/ui/invalid_sel.rs: -------------------------------------------------------------------------------- 1 | //! Test invalid selector syntax 2 | use objc2::sel; 3 | 4 | fn main() { 5 | sel!(); 6 | sel!(a: b); 7 | sel!(a: b: c); 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/main_thread_only_not_allocable.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | #[expect(unused_imports)] 3 | use objc2::AnyThread; 4 | use objc2::{define_class, MainThreadOnly}; 5 | 6 | define_class!( 7 | #[unsafe(super(NSObject))] 8 | #[thread_kind = MainThreadOnly] 9 | struct MyMainThreadOnlyClass; 10 | ); 11 | 12 | fn main() { 13 | let _ = MyMainThreadOnlyClass::alloc(); 14 | } 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/mainthreadmarker_from_nsobject.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::{MainThreadMarker, NSObject}; 2 | 3 | fn main() { 4 | let obj = NSObject::new(); 5 | let mtm = MainThreadMarker::from(&*obj); 6 | } 7 | -------------------------------------------------------------------------------- /crates/test-ui/ui/mainthreadmarker_not_send_sync.rs: -------------------------------------------------------------------------------- 1 | //! Test that MainThreadMarker is neither Send nor Sync. 2 | use objc2_foundation::MainThreadMarker; 3 | 4 | fn needs_sync() {} 5 | fn needs_send() {} 6 | 7 | fn main() { 8 | needs_sync::(); 9 | needs_send::(); 10 | } 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/message_receiver_simple.rs: -------------------------------------------------------------------------------- 1 | //! Test that `MessageReceiver` doesn't use our more fancy (but private) 2 | //! conversion traits. 3 | use objc2::runtime::{MessageReceiver, NSObject}; 4 | use objc2::sel; 5 | 6 | fn main() { 7 | let obj = NSObject::new(); 8 | 9 | // Receiver `&Retained` not allowed 10 | let _: usize = unsafe { MessageReceiver::send_message(&obj, sel!(hash), ()) }; 11 | 12 | // No `bool` argument conversion 13 | let _: () = unsafe { MessageReceiver::send_message(&*obj, sel!(hash:), (true,)) }; 14 | 15 | // No `bool` return conversion 16 | let _: bool = unsafe { MessageReceiver::send_message(&*obj, sel!(hash), ()) }; 17 | } 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_alloc_init_different.rs: -------------------------------------------------------------------------------- 1 | //! Ensure that `init` returns the same type as given from `alloc`. 2 | use objc2::rc::{Allocated, Retained}; 3 | use objc2::runtime::{AnyObject, NSObject}; 4 | use objc2::{class, msg_send}; 5 | 6 | fn main() { 7 | let cls = class!(NSObject); 8 | let obj: Allocated = unsafe { msg_send![cls, alloc] }; 9 | 10 | let _: Retained = unsafe { msg_send![obj, init] }; 11 | } 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_invalid_error2.rs: -------------------------------------------------------------------------------- 1 | //! Test that `msg_send!` with a non-NSError type fails. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | use objc2_foundation::NSString; 6 | 7 | fn main() { 8 | let obj = NSObject::new(); 9 | let _: Result<(), Retained> = unsafe { msg_send![&obj, doStuffWithError: _] }; 10 | } 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_invalid_error3.rs: -------------------------------------------------------------------------------- 1 | //! Test that `msg_send!` with a non-NSError type fails. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | use objc2_foundation::NSString; 6 | 7 | fn main() { 8 | let obj = NSObject::new(); 9 | let _: Result, Retained> = 10 | unsafe { msg_send![&obj, doMoreStuffWithError: _] }; 11 | } 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_missing_comma.rs: -------------------------------------------------------------------------------- 1 | //! Test msg_send! syntax with missing commas. 2 | #![deny(deprecated)] 3 | use objc2::{msg_send, ClassType}; 4 | use objc2_foundation::NSString; 5 | 6 | fn main() { 7 | let obj: &NSString = &NSString::new(); 8 | 9 | let _: () = unsafe { msg_send![super(obj), a:obj b:obj] }; 10 | let _: () = unsafe { msg_send![super(obj, NSString::class()), a:obj b:obj] }; 11 | let _: () = unsafe { msg_send![obj, a:obj b:obj] }; 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_mutable.rs: -------------------------------------------------------------------------------- 1 | //! Test that `msg_send!` consumes their arguments, including the receiver. 2 | //! 3 | //! Ideally, it shouldn't be so, but that's how it works currently. 4 | use objc2::runtime::AnyObject; 5 | use objc2::{class, msg_send}; 6 | 7 | fn main() { 8 | let cls = class!(NSObject); 9 | let obj: &mut AnyObject = unsafe { msg_send![cls, new] }; 10 | 11 | let _: () = unsafe { msg_send![obj, selector] }; 12 | // Could be solved with a reborrow 13 | let _: () = unsafe { msg_send![obj, selector] }; 14 | } 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_no_return_type.rs: -------------------------------------------------------------------------------- 1 | //! Test that forgetting to annotate the return type fails 2 | //! See https://github.com/SSheldon/rust-objc/issues/62 3 | use objc2::{class, msg_send}; 4 | 5 | fn main() { 6 | let cls = class!(NSObject); 7 | 8 | unsafe { msg_send![cls, new] }; 9 | } 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_not_allowed_mutable.rs: -------------------------------------------------------------------------------- 1 | //! Test msg_send! with mutable receivers. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | 6 | fn main() { 7 | let obj: &mut NSObject; 8 | 9 | let _: () = unsafe { msg_send![&mut *obj, test] }; 10 | 11 | let _: Retained = unsafe { msg_send![obj, test] }; 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_not_encode.rs: -------------------------------------------------------------------------------- 1 | //! Test that types that are not `Encode` are not accepted. 2 | use objc2::{class, msg_send}; 3 | 4 | fn main() { 5 | let cls = class!(NSData); 6 | unsafe { 7 | let _: Vec = msg_send![cls, new]; 8 | 9 | let x: Vec; 10 | let _: () = msg_send![cls, newWith: x]; 11 | 12 | let _: () = msg_send![cls, unitAsArgument: ()]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_only_message.rs: -------------------------------------------------------------------------------- 1 | //! Test that messages can only be sent to objects. 2 | use objc2::msg_send; 3 | 4 | fn main() { 5 | unsafe { msg_send![1, new] }; 6 | } 7 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_special_selectors.rs: -------------------------------------------------------------------------------- 1 | //! Test special selectors. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | 6 | fn main() { 7 | let object: &NSObject; 8 | let _: Retained = unsafe { msg_send![object, retain] }; 9 | let _: Retained = unsafe { msg_send![object, release] }; 10 | let _: Retained = unsafe { msg_send![object, autorelease] }; 11 | let _: Retained = unsafe { msg_send![object, dealloc] }; 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_super_not_classtype.rs: -------------------------------------------------------------------------------- 1 | //! Invalid receiver to msg_send![super(obj), ...], missing ClassType impl. 2 | use objc2::msg_send; 3 | use objc2::runtime::{NSObject, AnyObject}; 4 | 5 | fn main() { 6 | let obj: &AnyObject; 7 | let _: () = unsafe { msg_send![super(obj), method] }; 8 | 9 | let obj: &NSObject; // impls ClassType, but it's superclass does not 10 | let _: () = unsafe { msg_send![super(obj), method] }; 11 | } 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified.rs: -------------------------------------------------------------------------------- 1 | //! Test compiler output of msg_send! when result type is not properly specified. 2 | use objc2::msg_send; 3 | use objc2::runtime::NSObject; 4 | 5 | fn main() { 6 | let obj: &NSObject; 7 | let _: &NSObject = &*unsafe { msg_send![obj, description] }; 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified.stderr: -------------------------------------------------------------------------------- 1 | error[E0282]: type annotations needed 2 | --> ui/msg_send_underspecified.rs 3 | | 4 | | let _: &NSObject = &*unsafe { msg_send![obj, description] }; 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error.rs: -------------------------------------------------------------------------------- 1 | //! Test underspecified msg_send! errors. 2 | use objc2::msg_send; 3 | use objc2::runtime::NSObject; 4 | 5 | fn main() { 6 | let obj: &NSObject; 7 | let _: Result<(), _> = unsafe { msg_send![obj, error: _] }; 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error.stderr: -------------------------------------------------------------------------------- 1 | error[E0282]: type annotations needed 2 | --> ui/msg_send_underspecified_error.rs 3 | | 4 | | let _: Result<(), _> = unsafe { msg_send![obj, error: _] }; 5 | | ^^^^^^^^^^^^^ cannot infer type 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error1.rs: -------------------------------------------------------------------------------- 1 | //! Test underspecified msg_send! errors. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2::runtime::NSObject; 5 | 6 | fn main() { 7 | let obj: &NSObject; 8 | let _: Result, _> = unsafe { msg_send![obj, error: _] }; 9 | } 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error1.stderr: -------------------------------------------------------------------------------- 1 | error[E0282]: type annotations needed 2 | --> ui/msg_send_underspecified_error1.rs 3 | | 4 | | let _: Result, _> = unsafe { msg_send![obj, error: _] }; 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type 6 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error2.rs: -------------------------------------------------------------------------------- 1 | //! Test underspecified msg_send! errors. 2 | use objc2::msg_send; 3 | use objc2::rc::Retained; 4 | use objc2_foundation::{NSError, NSObject}; 5 | 6 | fn main() { 7 | let obj: &NSObject; 8 | let _: Result<_, Retained> = unsafe { msg_send![obj, error: _] }; 9 | } 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_underspecified_error3.rs: -------------------------------------------------------------------------------- 1 | //! Test underspecified msg_send! errors. 2 | use objc2::msg_send; 3 | use objc2::runtime::NSObject; 4 | 5 | fn main() { 6 | let obj: &NSObject; 7 | let _: Result<_, _> = unsafe { msg_send![obj, error: _] }; 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_unwrap.rs: -------------------------------------------------------------------------------- 1 | //! Test calling something on return from `msg_send!`. 2 | use objc2::rc::Retained; 3 | use objc2::runtime::NSObject; 4 | use objc2::{class, msg_send}; 5 | 6 | fn main() { 7 | let cls = class!(NSObject); 8 | let _: Retained = unsafe { msg_send![cls, new].unwrap() }; 9 | } 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/msg_send_unwrap.stderr: -------------------------------------------------------------------------------- 1 | error[E0282]: type annotations needed 2 | --> ui/msg_send_unwrap.rs 3 | | 4 | | let _: Retained = unsafe { msg_send![cls, new].unwrap() }; 5 | | ^^^^^^^^^^^^^^^^^^^ cannot infer type 6 | | 7 | = note: this error originates in the macro `$crate::__msg_send_parse` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/ns_copying_without_copy_helper.rs: -------------------------------------------------------------------------------- 1 | use objc2::extern_class; 2 | use objc2_foundation::{NSCopying, NSMutableCopying, NSObject}; 3 | 4 | extern_class!( 5 | #[unsafe(super(NSObject))] 6 | struct MyObj; 7 | ); 8 | 9 | unsafe impl NSCopying for MyObj {} 10 | unsafe impl NSMutableCopying for MyObj {} 11 | 12 | #[allow(unreachable_code)] 13 | fn main() { 14 | let obj: &MyObj = unimplemented!(); 15 | let _ = obj.copy(); 16 | let _ = obj.mutableCopy(); 17 | } 18 | -------------------------------------------------------------------------------- /crates/test-ui/ui/ns_string_not_const.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | use objc2_foundation::ns_string; 3 | 4 | fn main() { 5 | let s: &str = "abc"; 6 | let _ = ns_string!(s); 7 | } 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/ns_string_not_const.stderr: -------------------------------------------------------------------------------- 1 | error[E0435]: attempt to use a non-constant value in a constant 2 | --> ui/ns_string_not_const.rs 3 | | 4 | | let _ = ns_string!(s); 5 | | ^ non-constant value 6 | | 7 | help: consider using `let` instead of `const` 8 | --> $WORKSPACE/framework-crates/objc2-foundation/src/macros/ns_string.rs 9 | | 10 | - const INPUT: &str = $s; 11 | + let INPUT: &str = $s; 12 | | 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/ns_string_output_not_const.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::{ns_string, NSString}; 2 | 3 | fn main() { 4 | struct SyncString(&'static NSString); 5 | 6 | unsafe impl Sync for SyncString {} 7 | 8 | static STRING: SyncString = SyncString(ns_string!("abc")); 9 | } 10 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsarray_bound_not_send_sync.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::{NSArray, NSMutableArray, NSObject}; 2 | 3 | fn needs_sync() {} 4 | fn needs_send() {} 5 | 6 | fn main() { 7 | needs_sync::>(); 8 | needs_send::>(); 9 | needs_sync::>(); 10 | needs_send::>(); 11 | } 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsarray_not_message.rs: -------------------------------------------------------------------------------- 1 | //! Test output of creating `NSArray` from a non-`Message` type. 2 | use objc2::rc::Retained; 3 | use objc2_foundation::{NSArray, NSObject}; 4 | 5 | fn main() { 6 | let _: Retained> = NSArray::new(); 7 | let _: Retained>> = NSArray::from_slice(&[&NSObject::new()]); 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsobject_not_derefmut.rs: -------------------------------------------------------------------------------- 1 | use objc2::runtime::NSObject; 2 | 3 | fn main() { 4 | #[allow(unused_mut)] 5 | let mut obj = NSObject::new(); 6 | let _: &mut NSObject = &mut *obj; 7 | } 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsobject_not_derefmut.stderr: -------------------------------------------------------------------------------- 1 | error[E0596]: cannot borrow data in dereference of `Retained` as mutable 2 | --> ui/nsobject_not_derefmut.rs 3 | | 4 | | let _: &mut NSObject = &mut *obj; 5 | | ^^^^^^^^^ cannot borrow as mutable 6 | | 7 | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Retained` 8 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsstring_as_str_use_after_release.rs: -------------------------------------------------------------------------------- 1 | //! Test that the lifetime of `NSString::as_str` is bound to the string. 2 | use objc2::rc::autoreleasepool; 3 | use objc2_foundation::NSString; 4 | 5 | fn main() { 6 | autoreleasepool(|pool| unsafe { 7 | let ns_string = NSString::new(); 8 | let s = ns_string.to_str(pool); 9 | drop(ns_string); 10 | println!("{}", s); 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsstring_as_str_use_after_release.stderr: -------------------------------------------------------------------------------- 1 | error[E0505]: cannot move out of `ns_string` because it is borrowed 2 | --> ui/nsstring_as_str_use_after_release.rs 3 | | 4 | | let ns_string = NSString::new(); 5 | | --------- binding `ns_string` declared here 6 | | let s = ns_string.to_str(pool); 7 | | --------- borrow of `ns_string` occurs here 8 | | drop(ns_string); 9 | | ^^^^^^^^^ move out of `ns_string` occurs here 10 | | println!("{}", s); 11 | | - borrow later used here 12 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsstring_as_str_use_outside_pool.rs: -------------------------------------------------------------------------------- 1 | //! Test that the lifetime of `NSString::as_str` is bound to the pool. 2 | use objc2::rc::autoreleasepool; 3 | use objc2_foundation::NSString; 4 | 5 | fn main() { 6 | let ns_string = NSString::new(); 7 | let _s = autoreleasepool(|pool| unsafe { ns_string.to_str(pool) }); 8 | } 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/nsstring_as_str_use_outside_pool.stderr: -------------------------------------------------------------------------------- 1 | error: lifetime may not live long enough 2 | --> ui/nsstring_as_str_use_outside_pool.rs 3 | | 4 | | let _s = autoreleasepool(|pool| unsafe { ns_string.to_str(pool) }); 5 | | ----- ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` 6 | | | | 7 | | | return type of closure is &'2 str 8 | | has type `AutoreleasePool<'1>` 9 | -------------------------------------------------------------------------------- /crates/test-ui/ui/object_not_send_sync.rs: -------------------------------------------------------------------------------- 1 | //! Test that AnyObject and NSObject are not Send and Sync, because their 2 | //! subclasses might not be. 3 | //! 4 | //! Also test that `NSValue` is not Send nor Sync, because its contained value 5 | //! might not be. 6 | use objc2::runtime::{AnyObject, NSObject}; 7 | use objc2_foundation::NSValue; 8 | 9 | fn needs_sync() {} 10 | fn needs_send() {} 11 | 12 | fn main() { 13 | needs_sync::(); 14 | needs_send::(); 15 | needs_sync::(); 16 | needs_send::(); 17 | needs_sync::(); 18 | needs_send::(); 19 | } 20 | -------------------------------------------------------------------------------- /crates/test-ui/ui/stack_block_requires_clone.rs: -------------------------------------------------------------------------------- 1 | use block2::StackBlock; 2 | 3 | struct Foo; 4 | 5 | fn main() { 6 | let foo = Foo; 7 | let _ = StackBlock::new(move || { 8 | let _ = &foo; 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /crates/test-ui/ui/stack_block_with_encoding_requires_clone.rs: -------------------------------------------------------------------------------- 1 | use block2::{ManualBlockEncoding, StackBlock}; 2 | use std::ffi::CStr; 3 | 4 | struct Foo; 5 | 6 | fn main() { 7 | struct FooBlockEncoding; 8 | unsafe impl ManualBlockEncoding for FooBlockEncoding { 9 | type Arguments = (); 10 | type Return = (); 11 | const ENCODING_CSTR: &'static CStr = c"v8@?0"; 12 | } 13 | 14 | let foo = Foo; 15 | let _ = StackBlock::with_encoding::(move || { 16 | let _ = &foo; 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /crates/test-ui/ui/thread_kind_traits_unimplementable.rs: -------------------------------------------------------------------------------- 1 | //! Check that `MainThreadOnly`/`AnyThread` traits are not implementable manually. 2 | use objc2::runtime::NSObject; 3 | use objc2::{define_class, AnyThread, MainThreadOnly}; 4 | 5 | define_class!( 6 | #[unsafe(super(NSObject))] 7 | #[thread_kind = AnyThread] 8 | #[ivars = *mut ()] 9 | struct Normal; 10 | ); 11 | 12 | unsafe impl MainThreadOnly for Normal {} 13 | 14 | define_class!( 15 | #[unsafe(super(NSObject))] 16 | #[thread_kind = MainThreadOnly] 17 | struct OnlyMain; 18 | ); 19 | 20 | unsafe impl AnyThread for OnlyMain {} 21 | 22 | fn main() {} 23 | -------------------------------------------------------------------------------- /crates/test-ui/ui/thread_kind_traits_unimplementable2.rs: -------------------------------------------------------------------------------- 1 | //! Check that `AnyThread`/`MainThreadOnly` traits are not implementable manually. 2 | use objc2::{AnyThread, MainThreadOnly}; 3 | 4 | struct CustomStruct; 5 | 6 | unsafe impl AnyThread for CustomStruct {} 7 | 8 | unsafe impl MainThreadOnly for CustomStruct {} 9 | 10 | fn main() {} 11 | -------------------------------------------------------------------------------- /crates/tests/compat-headers/gnustep-pre-2-0/Block.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /crates/tests/compat-headers/gnustep-pre-2-0/Block_private.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /crates/tests/compat-headers/objfw/Block.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /crates/tests/compat-headers/objfw/objc/objc.h: -------------------------------------------------------------------------------- 1 | #import 2 | -------------------------------------------------------------------------------- /crates/tests/compat-headers/objfw/objc/runtime.h: -------------------------------------------------------------------------------- 1 | #import 2 | -------------------------------------------------------------------------------- /crates/tests/src/rc_test_object.rs: -------------------------------------------------------------------------------- 1 | ../../objc2/src/rc/test_object.rs -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | ## Notes 4 | 5 | Aim to be self-contained. The examples use explicit version numbers instead of `path = "../xyz"`, and instead we rely on a top-level `[patch.crates-io]` section to resolve it. 6 | -------------------------------------------------------------------------------- /examples/app/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "examples-app" 3 | version = "0.0.0" 4 | edition = "2021" 5 | license = "Zlib OR Apache-2.0 OR MIT" 6 | publish = false 7 | 8 | [[example]] 9 | name = "delegate" 10 | path = "delegate.rs" 11 | 12 | [dependencies] 13 | objc2 = "0.6.1" 14 | objc2-foundation = { version = "0.3.1", default-features = false, features = [ 15 | "std", 16 | "NSNotification", 17 | "NSString", 18 | "NSObject", 19 | "NSThread", 20 | ] } 21 | objc2-app-kit = { version = "0.3.1", default-features = false, features = [ 22 | "std", 23 | "NSResponder", 24 | "NSApplication", 25 | "NSRunningApplication", 26 | ] } 27 | -------------------------------------------------------------------------------- /examples/audio/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "examples-audio" 3 | version = "0.0.0" 4 | edition = "2021" 5 | license = "Zlib OR Apache-2.0 OR MIT" 6 | publish = false 7 | 8 | [[example]] 9 | name = "speech_synthesis" 10 | path = "speech_synthesis.rs" 11 | 12 | [dependencies] 13 | objc2 = "0.6.1" 14 | objc2-foundation = { version = "0.3.1", default-features = false, features = [ 15 | "std", 16 | "NSString", 17 | "NSObject", 18 | ] } 19 | -------------------------------------------------------------------------------- /examples/corefoundation/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "examples-corefoundation" 3 | version = "0.0.0" 4 | edition = "2021" 5 | license = "Zlib OR Apache-2.0 OR MIT" 6 | publish = false 7 | 8 | [[example]] 9 | name = "runloop" 10 | path = "runloop.rs" 11 | 12 | [dependencies] 13 | objc2-core-foundation = { version = "0.3.1", default-features = false, features = [ 14 | "std", 15 | "CFString", 16 | "CFDate", 17 | "CFRunLoop", 18 | ] } 19 | -------------------------------------------------------------------------------- /examples/pasteboard/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "examples-pasteboard" 3 | version = "0.0.0" 4 | edition = "2021" 5 | license = "Zlib OR Apache-2.0 OR MIT" 6 | publish = false 7 | 8 | [[example]] 9 | name = "nspasteboard" 10 | path = "nspasteboard.rs" 11 | 12 | [dependencies] 13 | objc2 = "0.6.1" 14 | objc2-foundation = { version = "0.3.1", default-features = false, features = [ 15 | "std", 16 | "NSArray", 17 | "NSString", 18 | "NSObject", 19 | ] } 20 | objc2-app-kit = { version = "0.3.1", default-features = false, features = [ 21 | "std", 22 | "NSPasteboard", 23 | ] } 24 | -------------------------------------------------------------------------------- /framework-crates/.gitattributes: -------------------------------------------------------------------------------- 1 | */Cargo.toml linguist-generated 2 | */README.md linguist-generated 3 | */src/generated linguist-generated 4 | -------------------------------------------------------------------------------- /framework-crates/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../crates/objc2/src/topics/about_generated/CHANGELOG.md -------------------------------------------------------------------------------- /framework-crates/objc2-accessibility/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Accessibility -------------------------------------------------------------------------------- /framework-crates/objc2-accessibility/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Accessibility" 2 | crate = "objc2-accessibility" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | tvos = "14.0" 8 | watchos = "7.0" 9 | visionos = "1.0" 10 | 11 | # Both static and enum. 12 | static.AXFeatureOverrideSessionErrorDomain.skipped = true 13 | -------------------------------------------------------------------------------- /framework-crates/objc2-accessory-setup-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AccessorySetupKit -------------------------------------------------------------------------------- /framework-crates/objc2-accessory-setup-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AccessorySetupKit" 2 | crate = "objc2-accessory-setup-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | ios = "18.0" 5 | maccatalyst = "18.0" 6 | 7 | external.CBUUID.module = "CoreBluetooth.CBUUID" 8 | class.ASAccessorySession.methods."activateWithQueue:eventHandler:".skipped = true 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-accounts/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Accounts -------------------------------------------------------------------------------- /framework-crates/objc2-accounts/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Accounts" 2 | crate = "objc2-accounts" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.8" 5 | maccatalyst = "13.0" 6 | ios = "5.0" 7 | 8 | # Both enum and typedef 9 | typedef.ACErrorCode.skipped = true 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-ad-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AdServices -------------------------------------------------------------------------------- /framework-crates/objc2-ad-services/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AdServices" 2 | crate = "objc2-ad-services" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.1" 5 | maccatalyst = "14.3" 6 | ios = "14.3" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-ad-support/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AdSupport -------------------------------------------------------------------------------- /framework-crates/objc2-ad-support/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AdSupport" 2 | crate = "objc2-ad-support" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.14" 5 | maccatalyst = "13.0" 6 | ios = "6.0" 7 | tvos = "9.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-app-clip/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AppClip -------------------------------------------------------------------------------- /framework-crates/objc2-app-clip/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AppClip" 2 | crate = "objc2-app-clip" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "14.0" 5 | ios = "14.0" 6 | 7 | external.CLRegion.module = "CoreLocation.CLRegion" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-app-kit/src/event.rs: -------------------------------------------------------------------------------- 1 | use crate::{NSEventMask, NSEventType}; 2 | 3 | impl NSEventMask { 4 | #[doc(alias = "NSEventMaskFromType")] 5 | pub fn from_type(ty: NSEventType) -> Self { 6 | Self(1 << ty.0) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-app-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AppKit -------------------------------------------------------------------------------- /framework-crates/objc2-app-tracking-transparency/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AppTrackingTransparency -------------------------------------------------------------------------------- /framework-crates/objc2-app-tracking-transparency/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AppTrackingTransparency" 2 | crate = "objc2-app-tracking-transparency" 3 | required-crates = ["objc2"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | tvos = "14.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-application-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ApplicationServices -------------------------------------------------------------------------------- /framework-crates/objc2-ar-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ARKit -------------------------------------------------------------------------------- /framework-crates/objc2-audio-toolbox/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AudioToolbox -------------------------------------------------------------------------------- /framework-crates/objc2-authentication-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AuthenticationServices -------------------------------------------------------------------------------- /framework-crates/objc2-automatic-assessment-configuration/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AutomaticAssessmentConfiguration -------------------------------------------------------------------------------- /framework-crates/objc2-automatic-assessment-configuration/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AutomaticAssessmentConfiguration" 2 | crate = "objc2-automatic-assessment-configuration" 3 | required-crates = ["bitflags", "objc2", "objc2-foundation"] 4 | macos = "10.15.4" 5 | maccatalyst = "13.4" 6 | ios = "13.4" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-automator/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Automator -------------------------------------------------------------------------------- /framework-crates/objc2-automator/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Automator" 2 | crate = "objc2-automator" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.4" 5 | maccatalyst = "14.0" 6 | 7 | # error: translator assertion failure: invalid error nullability (left: Unspecified) (Right: Nullable) 8 | class.AMWorkspace.methods."runWorkflowAtPath:withInput:error:".skipped = true 9 | 10 | class.AMWorkflowController.main-thread-only = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-av-foundation/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AVFoundation -------------------------------------------------------------------------------- /framework-crates/objc2-av-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AVKit -------------------------------------------------------------------------------- /framework-crates/objc2-av-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AVKit" 2 | crate = "objc2-av-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.9" 5 | maccatalyst = "13.0" 6 | ios = "8.0" 7 | tvos = "9.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | 11 | # Has no declaration elsewhere, unknown where these actually come from 12 | external.AVGroupExperienceCoordinator.module = "AVKit.AVPlayerViewController" 13 | external.AVContentProposal.module = "AVKit.AVPlayerViewController" 14 | 15 | # Defined in AVRouting. 16 | external.AVCustomRoutingController.module = "AVRouting.AVCustomRoutingController" 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-av-routing/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AVRouting -------------------------------------------------------------------------------- /framework-crates/objc2-av-routing/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "AVRouting" 2 | crate = "objc2-av-routing" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | visionos = "1.0" 8 | 9 | external.UTType.module = "UniformTypeIdentifiers.UTType" 10 | 11 | # Needs nw_endpoint_t from Network 12 | class.AVCustomDeviceRoute.methods.networkEndpoint.skipped = true 13 | -------------------------------------------------------------------------------- /framework-crates/objc2-avf-audio/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/AVFAudio -------------------------------------------------------------------------------- /framework-crates/objc2-background-assets/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/BackgroundAssets -------------------------------------------------------------------------------- /framework-crates/objc2-background-assets/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "BackgroundAssets" 2 | crate = "objc2-background-assets" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-background-tasks/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/BackgroundTasks -------------------------------------------------------------------------------- /framework-crates/objc2-background-tasks/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "BackgroundTasks" 2 | crate = "objc2-background-tasks" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "13.0" 6 | tvos = "13.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-core/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | // FIXME: We need a better way to determine this. 3 | // https://github.com/rust-lang/rust/issues/73628#issuecomment-2467241918 4 | println!("cargo:rustc-check-cfg=cfg(arm64e)"); 5 | if std::env::var("TARGET").unwrap().contains("arm64e") { 6 | println!("cargo::rustc-cfg=arm64e"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-core/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/BrowserEngineCore -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-core/tests/memory/.gitattributes: -------------------------------------------------------------------------------- 1 | *.s linguist-generated 2 | *.ll linguist-generated 3 | -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-core/tests/memory/use_c.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #pragma clang diagnostic ignored "-Wunguarded-availability-new" 4 | 5 | void rw() { 6 | be_memory_inline_jit_restrict_rwx_to_rw_with_witness(); 7 | } 8 | 9 | void rx() { 10 | be_memory_inline_jit_restrict_rwx_to_rx_with_witness(); 11 | } 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-core/tests/memory/use_rs.rs: -------------------------------------------------------------------------------- 1 | use objc2_browser_engine_core::{ 2 | be_memory_inline_jit_restrict_rwx_to_rw_with_witness, 3 | be_memory_inline_jit_restrict_rwx_to_rx_with_witness, 4 | }; 5 | 6 | #[no_mangle] 7 | extern "C" fn rw() { 8 | be_memory_inline_jit_restrict_rwx_to_rw_with_witness(); 9 | } 10 | 11 | #[no_mangle] 12 | extern "C" fn rx() { 13 | be_memory_inline_jit_restrict_rwx_to_rx_with_witness(); 14 | } 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-browser-engine-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/BrowserEngineKit -------------------------------------------------------------------------------- /framework-crates/objc2-business-chat/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/BusinessChat -------------------------------------------------------------------------------- /framework-crates/objc2-business-chat/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "BusinessChat" 2 | crate = "objc2-business-chat" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-app-kit"] 4 | macos = "10.14" 5 | maccatalyst = "13.0" # Unsure 6 | ios = "11.0" # Unsure 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-call-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CallKit -------------------------------------------------------------------------------- /framework-crates/objc2-call-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CallKit" 2 | crate = "objc2-call-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "13.0" 6 | maccatalyst = "13.0" 7 | ios = "10.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | 11 | external.AVAudioSession.module = "AVFAudio.AVAudioSession" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-car-play/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CarPlay -------------------------------------------------------------------------------- /framework-crates/objc2-car-play/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CarPlay" 2 | crate = "objc2-car-play" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "14.0" 5 | ios = "12.0" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-carbon/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Carbon -------------------------------------------------------------------------------- /framework-crates/objc2-carbon/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Bindings to the `Carbon` framework 2 | //! 3 | //! This is currently empty. [Open an issue][new-issue] if you need to use 4 | //! symbols from this framework. 5 | //! 6 | //! [new-issue]: https://github.com/madsmtm/objc2/issues/new 7 | #![no_std] 8 | 9 | #[cfg(feature = "alloc")] 10 | extern crate alloc; 11 | 12 | #[cfg(feature = "std")] 13 | extern crate std; 14 | 15 | mod generated; 16 | #[allow(unused_imports, unreachable_pub)] 17 | pub use self::generated::*; 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-cf-network/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CFNetwork -------------------------------------------------------------------------------- /framework-crates/objc2-cf-network/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CFNetwork" 2 | crate = "objc2-cf-network" 3 | required-crates = ["objc2-core-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.8" 6 | maccatalyst = "13.0" 7 | ios = "2.0" 8 | tvos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-cinematic/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Cinematic -------------------------------------------------------------------------------- /framework-crates/objc2-cinematic/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Cinematic" 2 | crate = "objc2-cinematic" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "14.0" 5 | ios = "17.0" 6 | tvos = "17.0" 7 | 8 | # Seems to return the same object, unclear why these implement NSMutableCopying. 9 | class.CNBoundsPrediction.skipped-protocols = ["NSMutableCopying"] 10 | class.CNRenderingSessionFrameAttributes.skipped-protocols = ["NSMutableCopying"] 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-class-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ClassKit -------------------------------------------------------------------------------- /framework-crates/objc2-class-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ClassKit" 2 | crate = "objc2-class-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "11.4" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-clock-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ClockKit -------------------------------------------------------------------------------- /framework-crates/objc2-clock-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ClockKit" 2 | crate = "objc2-clock-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "14.0" 5 | ios = "14.0" 6 | watchos = "10.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-cloud-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CloudKit -------------------------------------------------------------------------------- /framework-crates/objc2-cloud-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CloudKit" 2 | crate = "objc2-cloud-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "13.0" 6 | ios = "8.0" 7 | tvos = "9.0" 8 | watchos = "3.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-collaboration/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Collaboration -------------------------------------------------------------------------------- /framework-crates/objc2-collaboration/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Collaboration" 2 | crate = "objc2-collaboration" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.5" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-color-sync/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ColorSync -------------------------------------------------------------------------------- /framework-crates/objc2-color-sync/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ColorSync" 2 | crate = "objc2-color-sync" 3 | required-crates = ["objc2-core-foundation"] 4 | macos = "10.13" 5 | maccatalyst = "13.0" 6 | ios = "16.0" 7 | tvos = "16.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | 11 | # Emit these. 12 | const.icVersion4Number.skipped = false 13 | const.COLORSYNC_PROFILE_INSTALL_ENTITLEMENT.skipped = false 14 | const.COLORSYNC_MD5_LENGTH.skipped = false 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-compositor-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CompositorServices -------------------------------------------------------------------------------- /framework-crates/objc2-compositor-services/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CompositorServices" 2 | crate = "objc2-compositor-services" 3 | required-crates = ["objc2"] # Currently 4 | flags = [ 5 | # Emit `cp_retain`/`cp_release`. 6 | "-DOS_OBJECT_USE_OBJC=0", 7 | ] 8 | visionos = "1.0" 9 | 10 | # ARKit is generated for iOS, and does not include 11 | # the visionOS module required here. 12 | fn.cp_drawable_set_device_anchor.skipped = true 13 | fn.cp_drawable_get_device_anchor.skipped = true 14 | -------------------------------------------------------------------------------- /framework-crates/objc2-contacts-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ContactsUI -------------------------------------------------------------------------------- /framework-crates/objc2-contacts-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ContactsUI" 2 | crate = "objc2-contacts-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.11" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | visionos = "1.0" 8 | 9 | external.CNContact.module = "Contacts.CNContact" 10 | external.CNContactProperty.module = "Contacts.CNContactProperty" 11 | external.CNKeyDescriptor.module = "Contacts.CNContact" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-contacts/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Contacts -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreAudioKit -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreAudioKit" 2 | crate = "objc2-core-audio-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | flags = [ 6 | # Make AudioToolbox less dependent on CoreServices 7 | "-DAUDIOCOMPONENT_NOCARBONINSTANCES=1", 8 | ] 9 | macos = "10.4" 10 | maccatalyst = "13.0" 11 | ios = "8.0" 12 | visionos = "1.0" 13 | 14 | # The original superclass typedef is a bit difficult to extract from the 15 | # superclass name, so let's do it manually. 16 | class.AUViewController.definition-skipped = true 17 | class.AUGenericViewController.definition-skipped = true 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio-types/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreAudioTypes -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio-types/src/session.rs: -------------------------------------------------------------------------------- 1 | // #if __LP64__ || NS_BUILD_32_LIKE_64 2 | // This is the same as NSInteger/NSUInteger, so let's use the same definition 3 | // as those (namely isize/usize). 4 | 5 | /// [Apple's documentation](https://developer.apple.com/documentation/coreaudiotypes/avaudiointeger?language=objc) 6 | pub type AVAudioInteger = isize; 7 | 8 | /// [Apple's documentation](https://developer.apple.com/documentation/coreaudiotypes/avaudiouinteger?language=objc) 9 | pub type AVAudioUInteger = usize; 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio-types/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreAudioTypes" 2 | crate = "objc2-core-audio-types" 3 | required-crates = [] 4 | link = false # This framework only contains types 5 | custom-lib-rs = true 6 | macos = "10.15" 7 | maccatalyst = "13.0" 8 | ios = "13.0" 9 | tvos = "13.0" 10 | watchos = "6.0" 11 | visionos = "1.0" 12 | 13 | # Differs based on architecture 14 | typedef.AVAudioInteger.skipped = true 15 | typedef.AVAudioUInteger.skipped = true 16 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-audio/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreAudio -------------------------------------------------------------------------------- /framework-crates/objc2-core-bluetooth/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreBluetooth -------------------------------------------------------------------------------- /framework-crates/objc2-core-bluetooth/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreBluetooth" 2 | crate = "objc2-core-bluetooth" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "13.0" 6 | ios = "5.0" 7 | tvos = "9.0" 8 | watchos = "4.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-data/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | gnustep-1-7 = [] 3 | gnustep-1-8 = [] 4 | gnustep-1-9 = [] 5 | gnustep-2-0 = [] 6 | gnustep-2-1 = [] 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-data/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreData -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | # Uses the nightly derive_coerce_pointee feature to make conversions more ergonomic. 3 | unstable-coerce-pointee = [] 4 | # For backwards compatibility, but unnecessary. 5 | CFBase = [] 6 | 7 | [dev-dependencies] 8 | static_assertions = "1.1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/__cf_macro_helpers.rs: -------------------------------------------------------------------------------- 1 | pub use core::borrow::Borrow; 2 | pub use core::cmp::{Eq, PartialEq}; 3 | pub use core::convert::AsRef; 4 | pub use core::fmt; 5 | pub use core::hash::{Hash, Hasher}; 6 | pub use core::marker::Sized; 7 | pub use core::mem::transmute; 8 | pub use core::ops::Deref; 9 | pub use core::primitive::bool; 10 | pub use core::stringify; 11 | #[cfg(feature = "objc2")] 12 | pub use objc2::cf_objc2_type; 13 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/error.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "CFString")] 2 | use core::fmt; 3 | 4 | use crate::CFError; 5 | 6 | impl fmt::Display for CFError { 7 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 8 | let desc = self.description().unwrap(); 9 | write!(f, "{desc}") 10 | } 11 | } 12 | 13 | #[cfg(feature = "std")] // use core::error::Error from Rust 1.81 once in MSRV. 14 | impl std::error::Error for CFError {} 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/filedescriptor.rs: -------------------------------------------------------------------------------- 1 | #![cfg(unix)] // std::os::fd only available on unix platforms. 2 | use std::os::fd::{AsRawFd, RawFd}; 3 | 4 | use crate::CFFileDescriptor; 5 | 6 | impl AsRawFd for CFFileDescriptor { 7 | fn as_raw_fd(&self) -> RawFd { 8 | self.native_descriptor() 9 | } 10 | } 11 | 12 | // NOTE: We cannot implement `AsFd`, since if `CFFileDescriptor` was created 13 | // with `closeOnInvalidate`, the user could close the file descriptor while 14 | // the `BorrowedFd` was alive, thus breaking its invariant. 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreFoundation -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/opaque.rs: -------------------------------------------------------------------------------- 1 | use core::{ 2 | cell::UnsafeCell, 3 | marker::{PhantomData, PhantomPinned}, 4 | }; 5 | 6 | /// An opaque type. 7 | /// 8 | /// This is used to avoid problems with e.g. getting references from 9 | /// `CFArray` (we can't use `c_void` as the default type, as `&c_void` would 10 | /// be incorrect). 11 | #[repr(C)] 12 | #[doc(hidden)] 13 | #[allow(dead_code, unreachable_pub)] 14 | pub struct Opaque { 15 | inner: [u8; 0], 16 | _p: UnsafeCell, PhantomPinned)>>, 17 | } 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/retained/forwarding_impls.rs: -------------------------------------------------------------------------------- 1 | ../../../../crates/objc2/src/rc/retained_forwarding_impls.rs -------------------------------------------------------------------------------- /framework-crates/objc2-core-foundation/src/timezone.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "CFDate")] 2 | 3 | #[cfg(test)] 4 | mod tests { 5 | use crate::CFTimeZone; 6 | 7 | #[test] 8 | fn cmp() { 9 | let system = CFTimeZone::system().unwrap(); 10 | let default = CFTimeZone::default().unwrap(); 11 | assert_eq!(system, default); 12 | assert_eq!(system.name().unwrap(), default.name().unwrap(),); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-graphics/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreGraphics -------------------------------------------------------------------------------- /framework-crates/objc2-core-graphics/src/image.rs: -------------------------------------------------------------------------------- 1 | use crate::CGBitmapInfo; 2 | 3 | #[allow(non_upper_case_globals)] 4 | impl CGBitmapInfo { 5 | #[doc(alias = "kCGBitmapByteOrder16Host")] 6 | pub const ByteOrder16Host: Self = if cfg!(target_endian = "big") { 7 | Self::ByteOrder16Big 8 | } else { 9 | Self::ByteOrder16Little 10 | }; 11 | 12 | #[doc(alias = "kCGBitmapByteOrder32Host")] 13 | pub const ByteOrder32Host: Self = if cfg!(target_endian = "big") { 14 | Self::ByteOrder32Big 15 | } else { 16 | Self::ByteOrder32Little 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-haptics/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreHaptics -------------------------------------------------------------------------------- /framework-crates/objc2-core-haptics/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreHaptics" 2 | crate = "objc2-core-haptics" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "13.0" 6 | tvos = "14.0" 7 | visionos = "1.0" 8 | 9 | external.AVAudioSession.module = "AVFAudio.AVAudioSession" 10 | 11 | # Needs `ns_string!` that works reliably in statics. 12 | static.CoreHapticsErrorDomain.skipped = true 13 | 14 | # error: unknown error result type 15 | class.CHHapticEngine.methods."registerAudioResource:options:error:".skipped = true 16 | 17 | # Emit this. 18 | const.CHHapticTimeImmediate.skipped = false 19 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-image/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | # Runtime selection. See `objc2` for details. 3 | gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7"] 4 | gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8"] 5 | gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9"] 6 | gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0"] 7 | gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1"] 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-image/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreImage -------------------------------------------------------------------------------- /framework-crates/objc2-core-location-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreLocationUI -------------------------------------------------------------------------------- /framework-crates/objc2-core-location-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreLocationUI" 2 | crate = "objc2-core-location-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "15.0" 5 | ios = "15.0" 6 | watchos = "10.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-location/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreLocation -------------------------------------------------------------------------------- /framework-crates/objc2-core-location/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreLocation" 2 | crate = "objc2-core-location" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | # macos = "10.6" 5 | macos = "10.11" # Temporarily raised since `CoreLocation` imports `Contacts` 6 | maccatalyst = "13.0" 7 | ios = "2.0" 8 | tvos = "9.0" 9 | watchos = "2.0" 10 | visionos = "1.0" 11 | 12 | external.CNPostalAddress.module = "Contacts.CNPostalAddress" 13 | 14 | # error: translator assertion failure: (left `"CLLocation"`) (right `"const CLLocation"`) 15 | class.CLLocation.methods."getDistanceFrom:".skipped = true 16 | class.CLLocation.methods."distanceFromLocation:".skipped = true 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-media-io/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreMediaIO -------------------------------------------------------------------------------- /framework-crates/objc2-core-media-io/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreMediaIO" 2 | crate = "objc2-core-media-io" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.7" 6 | maccatalyst = "13.0" 7 | 8 | # Self-referential 9 | struct.CMIOHardwarePlugInInterface.skipped = true 10 | typedef.CMIOHardwarePlugInInterface.skipped = true 11 | typedef.CMIOHardwarePlugInRef.skipped = true 12 | 13 | # Uses CMIOHardwarePlugInInterface 14 | fn.CMIOObjectCreate.skipped = true 15 | fn.CMIOObjectsPublishedAndDied.skipped = true 16 | fn.CMIOObjectPropertiesChanged.skipped = true 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-media/src/base.rs: -------------------------------------------------------------------------------- 1 | // See CMBase.h 2 | 3 | // TODO: Or target_abi = "macabi" 4 | #[cfg(all(target_os = "macos", target_arch = "x86_64"))] 5 | type Inner = u32; // uint32_t 6 | #[cfg(not(all(target_os = "macos", target_arch = "x86_64")))] 7 | type Inner = usize; // uintptr_t 8 | 9 | /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmbaseclassversion?language=objc) 10 | pub type CMBaseClassVersion = Inner; 11 | 12 | /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmstructversion?language=objc) 13 | pub type CMStructVersion = Inner; 14 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-media/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreMedia -------------------------------------------------------------------------------- /framework-crates/objc2-core-midi/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreMIDI -------------------------------------------------------------------------------- /framework-crates/objc2-core-midi/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreMIDI" 2 | crate = "objc2-core-midi" 3 | # Neither objc2-foundation nor objc2-core-foundation, 4 | # CoreMIDI is split in two parts that each use one. 5 | required-crates = [] 6 | custom-lib-rs = true 7 | macos = "10.0" 8 | maccatalyst = "13.0" 9 | ios = "4.2" 10 | tvos = "15.0" 11 | watchos = "8.0" 12 | visionos = "1.0" 13 | 14 | # Wrongly renamed (Swift's renaming algorithm is insufficient) 15 | const.kMIDIProtocol_1_0.renamed = "Protocol_1_0" 16 | const.kMIDIProtocol_2_0.renamed = "Protocol_2_0" 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-ml/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreML -------------------------------------------------------------------------------- /framework-crates/objc2-core-ml/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreML" 2 | crate = "objc2-core-ml" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.13" 6 | maccatalyst = "10.13" 7 | ios = "11.0" 8 | tvos = "11.0" 9 | watchos = "4.0" 10 | visionos = "1.0" 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-motion/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreMotion -------------------------------------------------------------------------------- /framework-crates/objc2-core-motion/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreMotion" 2 | crate = "objc2-core-motion" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "4.0" 7 | watchos = "2.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-nfc/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreNFC -------------------------------------------------------------------------------- /framework-crates/objc2-core-nfc/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreNFC" 2 | crate = "objc2-core-nfc" 3 | required-crates = ["bitflags", "objc2", "objc2-foundation"] 4 | maccatalyst = "13.1" 5 | ios = "11.0" 6 | 7 | # Both protocol and class. 8 | protocol.NFCReaderSession.renamed = "NFCReaderSessionProtocol" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreServices -------------------------------------------------------------------------------- /framework-crates/objc2-core-spotlight/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreSpotlight -------------------------------------------------------------------------------- /framework-crates/objc2-core-spotlight/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreSpotlight" 2 | crate = "objc2-core-spotlight" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.13" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | visionos = "1.0" 8 | 9 | # Protocol conformance has mostly carried over from NSString, and a mutable 10 | # copy returns NSMutableString. 11 | class.CSLocalizedString.counterpart = "MutableSubclass(Foundation.NSString.NSMutableString)" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-telephony/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreTelephony -------------------------------------------------------------------------------- /framework-crates/objc2-core-telephony/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CoreTelephony" 2 | crate = "objc2-core-telephony" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "14.0" 6 | ios = "4.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-text/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [dev-dependencies] 2 | static_assertions = "1.1.0" 3 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-text/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreText -------------------------------------------------------------------------------- /framework-crates/objc2-core-text/src/thread_safety.rs: -------------------------------------------------------------------------------- 1 | #[cfg(test)] 2 | mod tests { 3 | #[allow(unused_imports)] 4 | use crate::*; 5 | 6 | // Ensure that toll-free bridged types are not marked as thread-safe. 7 | #[cfg(feature = "CTFont")] 8 | static_assertions::assert_not_impl_any!(CTFont: Send, Sync); 9 | #[cfg(feature = "CTFontCollection")] 10 | static_assertions::assert_not_impl_any!(CTFontCollection: Send, Sync); 11 | #[cfg(feature = "CTFontDescriptor")] 12 | static_assertions::assert_not_impl_any!(CTFontDescriptor: Send, Sync); 13 | #[cfg(feature = "CTGlyphInfo")] 14 | static_assertions::assert_not_impl_any!(CTGlyphInfo: Send, Sync); 15 | } 16 | -------------------------------------------------------------------------------- /framework-crates/objc2-core-video/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreVideo -------------------------------------------------------------------------------- /framework-crates/objc2-core-wlan/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CoreWLAN -------------------------------------------------------------------------------- /framework-crates/objc2-crypto-token-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/CryptoTokenKit -------------------------------------------------------------------------------- /framework-crates/objc2-crypto-token-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "CryptoTokenKit" 2 | crate = "objc2-crypto-token-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | tvos = "13.0" 8 | watchos = "8.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-data-detection/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/DataDetection -------------------------------------------------------------------------------- /framework-crates/objc2-data-detection/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "DataDetection" 2 | crate = "objc2-data-detection" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "12.0" 5 | maccatalyst = "15.0" 6 | ios = "15.0" 7 | tvos = "15.0" 8 | watchos = "8.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-device-check/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/DeviceCheck -------------------------------------------------------------------------------- /framework-crates/objc2-device-check/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "DeviceCheck" 2 | crate = "objc2-device-check" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "11.0" 7 | tvos = "11.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-device-discovery-extension/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/DeviceDiscoveryExtension -------------------------------------------------------------------------------- /framework-crates/objc2-device-discovery-extension/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "DeviceDiscoveryExtension" 2 | crate = "objc2-device-discovery-extension" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "15.0" 5 | ios = "16.0" 6 | visionos = "1.0" 7 | 8 | # Needs the Network framework 9 | class.DDDevice.methods.networkEndpoint.skipped = true 10 | class.DDDevice.methods."setNetworkEndpoint:".skipped = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-disk-arbitration/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/DiskArbitration -------------------------------------------------------------------------------- /framework-crates/objc2-event-kit-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/EventKitUI -------------------------------------------------------------------------------- /framework-crates/objc2-event-kit-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "EventKitUI" 2 | crate = "objc2-event-kit-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "4.0" 6 | visionos = "1.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-event-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/EventKit -------------------------------------------------------------------------------- /framework-crates/objc2-event-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "EventKit" 2 | crate = "objc2-event-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.8" 5 | maccatalyst = "13.0" 6 | ios = "4.0" 7 | watchos = "2.0" 8 | visionos = "1.0" 9 | 10 | external.NSColor.module = "AppKit.NSColor" 11 | external.MKMapItem.module = "MapKit.MKMapItem" 12 | 13 | # Needs the `AddressBook` framework 14 | class.EKParticipant.methods."ABPersonInAddressBook:".skipped = true 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-exception-handling/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ExceptionHandling -------------------------------------------------------------------------------- /framework-crates/objc2-exception-handling/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ExceptionHandling" 2 | crate = "objc2-exception-handling" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.0" 5 | maccatalyst = "13.0" 6 | 7 | # Emit these. 8 | const.NSLogAndHandleEveryExceptionMask.skipped = false 9 | const.NSHangOnEveryExceptionMask.skipped = false 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-execution-policy/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ExecutionPolicy -------------------------------------------------------------------------------- /framework-crates/objc2-execution-policy/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ExecutionPolicy" 2 | crate = "objc2-execution-policy" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-exposure-notification/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ExposureNotification -------------------------------------------------------------------------------- /framework-crates/objc2-exposure-notification/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ExposureNotification" 2 | crate = "objc2-exposure-notification" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | # maccatalyst = "13.5" # Documentation says it's available, but it seems to not be 5 | ios = "13.5" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-extension-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ExtensionKit -------------------------------------------------------------------------------- /framework-crates/objc2-extension-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ExtensionKit" 2 | crate = "objc2-extension-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "13.0" 6 | ios = "16.1" 7 | tvos = "16.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-external-accessory/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ExternalAccessory -------------------------------------------------------------------------------- /framework-crates/objc2-external-accessory/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ExternalAccessory" 2 | crate = "objc2-external-accessory" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.13" 5 | maccatalyst = "16.0" 6 | ios = "3.0" 7 | tvos = "10.0" 8 | visionos = "1.0" 9 | 10 | # Needs the `UIKit` framework 11 | class.EAWiFiUnconfiguredAccessoryBrowser.methods."configureAccessory:withConfigurationUIOnViewController:".skipped = true 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-file-provider-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/FileProviderUI -------------------------------------------------------------------------------- /framework-crates/objc2-file-provider-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "FileProviderUI" 2 | crate = "objc2-file-provider-ui" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-file-provider"] 4 | macos = "10.15" 5 | maccatalyst = "15.0" 6 | ios = "11.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-file-provider/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/FileProvider -------------------------------------------------------------------------------- /framework-crates/objc2-file-provider/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "FileProvider" 2 | crate = "objc2-file-provider" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.15" 6 | ios = "11.0" 7 | visionos = "1.0" 8 | 9 | external.UTType.module = "UniformTypeIdentifiers.UTType" 10 | 11 | # Protocol that has a typedef defined for it for ease of use 12 | protocol.NSFileProviderItem.renamed = "NSFileProviderItemProtocol" 13 | -------------------------------------------------------------------------------- /framework-crates/objc2-finder-sync/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/FinderSync -------------------------------------------------------------------------------- /framework-crates/objc2-finder-sync/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "FinderSync" 2 | crate = "objc2-finder-sync" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | 6 | # Both a protocol and a class, so we use Swift's naming scheme 7 | protocol.FIFinderSync.renamed = "FIFinderSyncProtocol" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/__ns_macro_helpers/mod.rs: -------------------------------------------------------------------------------- 1 | mod cached; 2 | #[cfg(feature = "NSString")] 3 | mod ns_string; 4 | 5 | pub use self::cached::CachedRetained; 6 | #[cfg(feature = "NSString")] 7 | pub use self::ns_string::*; 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/bundle.rs: -------------------------------------------------------------------------------- 1 | use core::panic::{RefUnwindSafe, UnwindSafe}; 2 | 3 | use crate::NSBundle; 4 | 5 | impl UnwindSafe for NSBundle {} 6 | impl RefUnwindSafe for NSBundle {} 7 | 8 | impl NSBundle { 9 | #[cfg(feature = "NSString")] 10 | #[cfg(feature = "NSDictionary")] 11 | pub fn name(&self) -> Option> { 12 | let info = self.infoDictionary()?; 13 | let name = info.objectForKey(crate::ns_string!("CFBundleName"))?; 14 | Some(name.downcast().expect("CFBundleName to be NSString")) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Foundation -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/macros/mod.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "NSString")] 2 | mod ns_string; 3 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/ns_consumed.rs: -------------------------------------------------------------------------------- 1 | extern "C-unwind" { 2 | #[cfg(feature = "NSMapTable")] 3 | pub fn NSFreeMapTable(table: *mut crate::NSMapTable); 4 | } 5 | 6 | // TODO: Add `-[NSKeyedUnarchiverDelegate unarchiver:didDecodeObject:]` 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/process_info.rs: -------------------------------------------------------------------------------- 1 | use core::fmt; 2 | use core::panic::{RefUnwindSafe, UnwindSafe}; 3 | 4 | use crate::NSProcessInfo; 5 | 6 | impl UnwindSafe for NSProcessInfo {} 7 | impl RefUnwindSafe for NSProcessInfo {} 8 | 9 | impl fmt::Debug for NSProcessInfo { 10 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 11 | let mut debug = f.debug_struct("NSProcessInfo"); 12 | 13 | #[cfg(feature = "NSString")] 14 | debug.field("processName", &self.processName()); 15 | 16 | debug.finish_non_exhaustive() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/bundle.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "NSBundle")] 2 | use alloc::format; 3 | 4 | use crate::NSBundle; 5 | use objc2::runtime::NSObjectProtocol; 6 | 7 | #[test] 8 | #[cfg(feature = "NSString")] 9 | #[cfg(feature = "NSDictionary")] 10 | #[cfg_attr(not(target_os = "macos"), ignore = "varies between platforms")] 11 | fn try_running_functions() { 12 | // This is mostly empty since cargo doesn't bundle the application 13 | // before executing. 14 | 15 | let bundle = NSBundle::mainBundle(); 16 | let _ = bundle.description(); 17 | assert_eq!(format!("{:?}", bundle.infoDictionary().unwrap()), "{}"); 18 | assert_eq!(bundle.name(), None); 19 | } 20 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/decimal_number.rs: -------------------------------------------------------------------------------- 1 | #![cfg(all( 2 | feature = "NSDecimal", 3 | feature = "NSDecimalNumber", 4 | feature = "NSValue" 5 | ))] 6 | use objc2::AnyThread; 7 | 8 | use crate::{NSDecimal, NSDecimalNumber}; 9 | 10 | #[test] 11 | #[cfg_attr( 12 | feature = "gnustep-1-7", 13 | ignore = "has different encoding, yet unsupported" 14 | )] 15 | fn test_decimal_encoding() { 16 | let decimal = NSDecimal { 17 | _inner: 0, 18 | _mantissa: [0; 8], 19 | }; 20 | 21 | let obj = unsafe { NSDecimalNumber::initWithDecimal(NSDecimalNumber::alloc(), decimal) }; 22 | assert_eq!(decimal, unsafe { obj.decimalValue() }); 23 | } 24 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/lock.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "NSLock")] 2 | use crate::{NSLock, NSLocking}; 3 | 4 | #[test] 5 | fn lock_unlock() { 6 | let lock = NSLock::new(); 7 | unsafe { 8 | lock.lock(); 9 | assert!(!lock.tryLock()); 10 | lock.unlock(); 11 | assert!(lock.tryLock()); 12 | lock.unlock(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod array; 2 | mod attributed_string; 3 | mod auto_traits; 4 | mod bundle; 5 | mod data; 6 | mod decimal_number; 7 | mod dictionary; 8 | mod error; 9 | mod exception; 10 | mod lock; 11 | mod mutable_array; 12 | mod mutable_data; 13 | mod mutable_dictionary; 14 | mod mutable_set; 15 | mod mutable_string; 16 | mod number; 17 | mod process_info; 18 | mod proxy; 19 | mod set; 20 | mod string; 21 | mod task; 22 | mod thread; 23 | mod uuid; 24 | mod value; 25 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/proxy.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "NSProxy")] 2 | use crate::NSProxy; 3 | use objc2::ClassType; 4 | 5 | #[test] 6 | fn dummy() { 7 | let _cls = NSProxy::class(); 8 | } 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/src/tests/task.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "NSTask")] 2 | use crate::{NSObjectProtocol, NSTask}; 3 | 4 | use objc2::{sel, ClassType}; 5 | 6 | #[test] 7 | #[cfg_attr(not(target_vendor = "apple"), ignore = "only on Apple")] 8 | fn class_cluster_and_wait_method() { 9 | // This method happens to only be available on the concrete subclass NSConcreteTask. 10 | let sel = sel!(waitUntilExit); 11 | 12 | let method = NSTask::class().instance_method(sel); 13 | assert!(method.is_none(), "class does not have method"); 14 | 15 | let task = unsafe { NSTask::new() }; 16 | assert!(task.respondsToSelector(sel), "object has method"); 17 | } 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-foundation/tests/glob_import.rs: -------------------------------------------------------------------------------- 1 | //! Check that these imports do not import overlapping items. 2 | #![allow(unused_imports)] 3 | 4 | pub use objc2::runtime::*; 5 | pub use objc2::*; 6 | #[cfg(feature = "objc2-core-foundation")] 7 | pub use objc2_core_foundation::*; 8 | pub use objc2_foundation::*; 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-fs-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/FSKit -------------------------------------------------------------------------------- /framework-crates/objc2-game-controller/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/GameController -------------------------------------------------------------------------------- /framework-crates/objc2-game-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/GameKit -------------------------------------------------------------------------------- /framework-crates/objc2-gameplay-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/GameplayKit -------------------------------------------------------------------------------- /framework-crates/objc2-gameplay-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "GameplayKit" 2 | crate = "objc2-gameplay-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.11" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | tvos = "9.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-health-kit-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/HealthKitUI -------------------------------------------------------------------------------- /framework-crates/objc2-health-kit-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "HealthKitUI" 2 | crate = "objc2-health-kit-ui" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-ui-kit"] 4 | maccatalyst = "17.0" 5 | ios = "8.0" 6 | # tvos = "10.0" # Not actually available on tvOS 7 | watchos = "2.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-health-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/HealthKit -------------------------------------------------------------------------------- /framework-crates/objc2-health-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "HealthKit" 2 | crate = "objc2-health-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "13.0" 6 | maccatalyst = "13.0" 7 | ios = "8.0" 8 | watchos = "2.0" 9 | visionos = "1.0" 10 | 11 | external.CLLocation.module = "CoreLocation.CLLocation" 12 | 13 | # Emit this. 14 | const.HKUnitMolarMassBloodGlucose.skipped = false 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-home-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/HomeKit -------------------------------------------------------------------------------- /framework-crates/objc2-identity-lookup-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IdentityLookupUI -------------------------------------------------------------------------------- /framework-crates/objc2-identity-lookup-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "IdentityLookupUI" 2 | crate = "objc2-identity-lookup-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "12.0" 6 | visionos = "1.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-identity-lookup/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IdentityLookup -------------------------------------------------------------------------------- /framework-crates/objc2-identity-lookup/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "IdentityLookup" 2 | crate = "objc2-identity-lookup" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "11.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-image-capture-core/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ImageCaptureCore -------------------------------------------------------------------------------- /framework-crates/objc2-image-capture-core/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ImageCaptureCore" 2 | crate = "objc2-image-capture-core" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.6" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-image-io/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ImageIO -------------------------------------------------------------------------------- /framework-crates/objc2-image-io/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ImageIO" 2 | crate = "objc2-image-io" 3 | required-crates = ["objc2-core-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.8" 6 | maccatalyst = "13.0" 7 | ios = "4.0" 8 | tvos = "9.0" 9 | watchos = "2.0" 10 | visionos = "1.0" 11 | 12 | # Emit these. 13 | const.IMAGEIO_PNG_NO_FILTERS.skipped = false 14 | const.IMAGEIO_PNG_FILTER_NONE.skipped = false 15 | const.IMAGEIO_PNG_FILTER_SUB.skipped = false 16 | const.IMAGEIO_PNG_FILTER_UP.skipped = false 17 | const.IMAGEIO_PNG_FILTER_AVG.skipped = false 18 | const.IMAGEIO_PNG_FILTER_PAETH.skipped = false 19 | const.IMAGEIO_PNG_ALL_FILTERS.skipped = false 20 | -------------------------------------------------------------------------------- /framework-crates/objc2-input-method-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/InputMethodKit -------------------------------------------------------------------------------- /framework-crates/objc2-intents-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IntentsUI -------------------------------------------------------------------------------- /framework-crates/objc2-intents-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "IntentsUI" 2 | crate = "objc2-intents-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "12.0" 5 | maccatalyst = "13.0" 6 | ios = "10.0" 7 | tvos = "14.0" 8 | # watchos = "3.2" # Documentation says it's available, but it seems to not be 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-intents/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Intents -------------------------------------------------------------------------------- /framework-crates/objc2-io-bluetooth-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IOBluetoothUI -------------------------------------------------------------------------------- /framework-crates/objc2-io-bluetooth-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "IOBluetoothUI" 2 | crate = "objc2-io-bluetooth-ui" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-app-kit"] 4 | custom-lib-rs = true 5 | macos = "10.2" 6 | 7 | # TODO: Merge these somehow 8 | typedef.IOBluetoothPairingControllerRef.renamed = "IOBluetoothPairingControllerRef" 9 | typedef.IOBluetoothServiceBrowserControllerRef.renamed = "IOBluetoothServiceBrowserControllerRef" 10 | typedef.IOBluetoothDeviceSelectorControllerRef.renamed = "IOBluetoothDeviceSelectorControllerRef" 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-io-bluetooth/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IOBluetooth -------------------------------------------------------------------------------- /framework-crates/objc2-io-bluetooth/src/macros.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_macros, unused_imports)] 2 | 3 | macro_rules! err_system { 4 | ($x:expr) => { 5 | ((($x as u32) & 0x3f) as i32) << 26 6 | }; 7 | } 8 | 9 | macro_rules! err_sub { 10 | ($x:expr) => { 11 | ($x & 0xfff) << 14 12 | }; 13 | } 14 | 15 | macro_rules! iokit_bluetooth_err { 16 | ($return:expr) => { 17 | // (sys_iokit | sub_iokit_bluetooth | return) 18 | (err_system!(0x38) | err_sub!(8) | $return) as u32 19 | }; 20 | } 21 | 22 | pub(crate) use err_sub; 23 | pub(crate) use err_system; 24 | pub(crate) use iokit_bluetooth_err; 25 | -------------------------------------------------------------------------------- /framework-crates/objc2-io-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IOKit -------------------------------------------------------------------------------- /framework-crates/objc2-io-surface/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | # For backwards compatibility. 3 | ObjC = ["objc2"] 4 | -------------------------------------------------------------------------------- /framework-crates/objc2-io-surface/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IOSurface -------------------------------------------------------------------------------- /framework-crates/objc2-io-surface/src/io_surface.rs: -------------------------------------------------------------------------------- 1 | use core::cell::UnsafeCell; 2 | use core::marker::{PhantomData, PhantomPinned}; 3 | 4 | /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfaceref?language=objc) 5 | #[repr(C)] 6 | pub struct IOSurfaceRef { 7 | inner: [u8; 0], 8 | _p: UnsafeCell, PhantomPinned)>>, 9 | } 10 | 11 | #[cfg(feature = "objc2-core-foundation")] 12 | objc2_core_foundation::cf_type!( 13 | unsafe impl IOSurfaceRef {} 14 | ); 15 | 16 | #[cfg(feature = "objc2")] 17 | objc2::cf_objc2_type!( 18 | unsafe impl RefEncode<"__IOSurface"> for IOSurfaceRef {} 19 | ); 20 | -------------------------------------------------------------------------------- /framework-crates/objc2-io-usb-host/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/IOUSBHost -------------------------------------------------------------------------------- /framework-crates/objc2-itunes-library/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/iTunesLibrary -------------------------------------------------------------------------------- /framework-crates/objc2-itunes-library/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "iTunesLibrary" 2 | crate = "objc2-itunes-library" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.13" 5 | maccatalyst = "14.0" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-javascript-core/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/JavaScriptCore -------------------------------------------------------------------------------- /framework-crates/objc2-javascript-core/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "JavaScriptCore" 2 | crate = "objc2-javascript-core" 3 | required-crates = [] 4 | custom-lib-rs = true 5 | macos = "10.5" 6 | maccatalyst = "13.1" 7 | ios = "7.0" 8 | tvos = "9.0" 9 | visionos = "1.0" 10 | 11 | # Ends up re-defining OpaqueJSContext/OpaqueJSValue twice 12 | typedef.JSGlobalContextRef.skipped = true 13 | typedef.JSObjectRef.skipped = true 14 | -------------------------------------------------------------------------------- /framework-crates/objc2-latent-semantic-mapping/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/LatentSemanticMapping -------------------------------------------------------------------------------- /framework-crates/objc2-latent-semantic-mapping/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "LatentSemanticMapping" 2 | crate = "objc2-latent-semantic-mapping" 3 | required-crates = ["objc2-core-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.5" 6 | maccatalyst = "13.1" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-link-presentation/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/LinkPresentation -------------------------------------------------------------------------------- /framework-crates/objc2-link-presentation/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "LinkPresentation" 2 | crate = "objc2-link-presentation" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | tvos = "14.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-local-authentication-embedded-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/LocalAuthenticationEmbeddedUI -------------------------------------------------------------------------------- /framework-crates/objc2-local-authentication-embedded-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "LocalAuthenticationEmbeddedUI" 2 | crate = "objc2-local-authentication-embedded-ui" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-local-authentication"] 4 | macos = "12.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-local-authentication/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/LocalAuthentication -------------------------------------------------------------------------------- /framework-crates/objc2-local-authentication/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "LocalAuthentication" 2 | crate = "objc2-local-authentication" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "13.0" 6 | ios = "8.0" 7 | watchos = "9.0" 8 | visionos = "1.0" 9 | 10 | # Uses defines 11 | enum.LABiometryType.use-value = true 12 | const.LABiometryNone.use-value = false 13 | enum.LACompanionType.use-value = true 14 | enum.LAPolicy.use-value = true 15 | enum.LACredentialType.use-value = true 16 | enum.LAError.use-value = true 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-mail-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MailKit -------------------------------------------------------------------------------- /framework-crates/objc2-mail-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MailKit" 2 | crate = "objc2-mail-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "12.0" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-map-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MapKit -------------------------------------------------------------------------------- /framework-crates/objc2-map-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MapKit" 2 | crate = "objc2-map-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.9" 6 | maccatalyst = "13.0" 7 | ios = "3.0" 8 | tvos = "9.2" 9 | watchos = "2.0" 10 | visionos = "1.0" 11 | 12 | external.CNPostalAddress.module = "Contacts.CNPostalAddress" 13 | 14 | # Needs proper support for iOS 15 | class.MKMapItemRequest.methods."initWithMapFeatureAnnotation:".skipped = true 16 | class.MKMapItemRequest.methods.mapFeatureAnnotation.skipped = true 17 | class.MKMapItemRequest.methods.featureAnnotation.skipped = true 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-media-accessibility/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MediaAccessibility -------------------------------------------------------------------------------- /framework-crates/objc2-media-accessibility/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MediaAccessibility" 2 | crate = "objc2-media-accessibility" 3 | required-crates = ["objc2-core-foundation"] 4 | macos = "10.9" 5 | maccatalyst = "13.0" 6 | ios = "17.0" 7 | tvos = "17.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-media-extension/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MediaExtension -------------------------------------------------------------------------------- /framework-crates/objc2-media-extension/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MediaExtension" 2 | crate = "objc2-media-extension" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "15.0" 5 | maccatalyst = "18.0" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-media-player/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MediaPlayer -------------------------------------------------------------------------------- /framework-crates/objc2-media-player/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MediaPlayer" 2 | crate = "objc2-media-player" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.12.1" 5 | maccatalyst = "13.0" 6 | ios = "2.0" 7 | tvos = "9.0" 8 | watchos = "5.0" 9 | visionos = "1.0" 10 | 11 | external.NSImage.module = "AppKit.NSImage" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-media-setup/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MediaSetup -------------------------------------------------------------------------------- /framework-crates/objc2-media-setup/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MediaSetup" 2 | crate = "objc2-media-setup" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "15.4" 5 | ios = "14.0" 6 | visionos = "1.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-media-toolbox/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MediaToolbox -------------------------------------------------------------------------------- /framework-crates/objc2-media-toolbox/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MediaToolbox" 2 | crate = "objc2-media-toolbox" 3 | required-crates = ["objc2-core-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.9" 6 | maccatalyst = "6.0" 7 | ios = "6.0" 8 | tvos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-message-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MessageUI -------------------------------------------------------------------------------- /framework-crates/objc2-message-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MessageUI" 2 | crate = "objc2-message-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "3.0" 6 | visionos = "1.0" 7 | 8 | external.MSMessage.module = "Messages.MSMessage" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-messages/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Messages -------------------------------------------------------------------------------- /framework-crates/objc2-messages/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Messages" 2 | crate = "objc2-messages" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "14.0" 5 | ios = "10.0" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal-fx/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MetalFX -------------------------------------------------------------------------------- /framework-crates/objc2-metal-fx/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MetalFX" 2 | crate = "objc2-metal-fx" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-metal"] 4 | macos = "13.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MetalKit -------------------------------------------------------------------------------- /framework-crates/objc2-metal-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MetalKit" 2 | crate = "objc2-metal-kit" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-metal"] 4 | macos = "10.11" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | tvos = "9.0" 8 | visionos = "1.0" 9 | 10 | # TODO: Re-enable these once the relevant frameworks are present 11 | class.MTKMeshBufferAllocator.skipped-protocols = ["MDLMeshBufferAllocator"] 12 | class.MTKMeshBuffer.skipped-protocols = ["MDLMeshBuffer", "MDLNamed"] 13 | 14 | # error: unknown error result type 15 | class.MTKTextureLoader.methods."newTexturesWithContentsOfURLs:options:error:".skipped = true 16 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal-performance-shaders-graph/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MetalPerformanceShadersGraph -------------------------------------------------------------------------------- /framework-crates/objc2-metal-performance-shaders-graph/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MetalPerformanceShadersGraph" 2 | crate = "objc2-metal-performance-shaders-graph" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-metal"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | tvos = "14.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal-performance-shaders/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MetalPerformanceShaders -------------------------------------------------------------------------------- /framework-crates/objc2-metal/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | # Private framework functionality 3 | # 4 | # These functions/methods are all marked `unsafe`, since they may not always 5 | # exist. 6 | unstable-private = [ 7 | "objc2-foundation/NSString", 8 | "objc2-foundation/NSError", 9 | ] 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal/src/counters.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | use objc2::ffi::NSUInteger; 3 | 4 | pub const MTLCounterErrorValue: u64 = !0; 5 | pub const MTLCounterDontSample: NSUInteger = (-1isize) as NSUInteger; 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Metal -------------------------------------------------------------------------------- /framework-crates/objc2-metal/src/resource.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | use objc2::ffi::NSUInteger; 3 | 4 | pub const MTLResourceCPUCacheModeShift: NSUInteger = 0; 5 | pub const MTLResourceCPUCacheModeMask: NSUInteger = 0xf << MTLResourceCPUCacheModeShift; 6 | 7 | pub const MTLResourceStorageModeShift: NSUInteger = 4; 8 | pub const MTLResourceStorageModeMask: NSUInteger = 0xf << MTLResourceStorageModeShift; 9 | 10 | pub const MTLResourceHazardTrackingModeShift: NSUInteger = 8; 11 | pub const MTLResourceHazardTrackingModeMask: NSUInteger = 0x3 << MTLResourceHazardTrackingModeShift; 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal/src/texture.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | use crate::{MTLTextureSwizzle, MTLTextureSwizzleChannels}; 3 | 4 | pub const MTLTextureSwizzleChannelsDefault: MTLTextureSwizzleChannels = MTLTextureSwizzleChannels { 5 | red: MTLTextureSwizzle::Red, 6 | green: MTLTextureSwizzle::Green, 7 | blue: MTLTextureSwizzle::Blue, 8 | alpha: MTLTextureSwizzle::Alpha, 9 | }; 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-metal/tests/runs_with_core_graphics.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "MTLDevice")] 2 | use objc2_metal::MTLCreateSystemDefaultDevice; 3 | 4 | #[link(name = "CoreGraphics", kind = "framework")] 5 | extern "C" {} 6 | 7 | #[test] 8 | #[ignore = "doesn't work in CI"] 9 | fn test_create_default() { 10 | let _ = MTLCreateSystemDefaultDevice(); 11 | } 12 | 13 | #[test] 14 | fn get_all() { 15 | let _ = objc2_metal::MTLCopyAllDevices(); 16 | } 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-metric-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MetricKit -------------------------------------------------------------------------------- /framework-crates/objc2-ml-compute/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MLCompute -------------------------------------------------------------------------------- /framework-crates/objc2-ml-compute/tests/tensor.rs: -------------------------------------------------------------------------------- 1 | #![allow(deprecated)] 2 | #![cfg(feature = "MLCTensor")] 3 | #![cfg(feature = "MLCTypes")] 4 | use objc2_foundation::{NSArray, NSNumber}; 5 | use objc2_ml_compute::{MLCDataType, MLCTensor}; 6 | 7 | #[test] 8 | fn new() { 9 | unsafe { 10 | MLCTensor::tensorWithShape_dataType( 11 | &NSArray::from_retained_slice(&[NSNumber::new_u8(4), NSNumber::new_u8(4)]), 12 | MLCDataType::Float32, 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /framework-crates/objc2-ml-compute/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MLCompute" 2 | crate = "objc2-ml-compute" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | tvos = "14.0" 8 | 9 | external.MLModel.module = "CoreML.MLModel" 10 | 11 | # The internal encoding of this says it takes a float as the second argument, 12 | # which is inconsistent with the documentation, so to ensure that calling it 13 | # sound, we avoid emitting it. 14 | class.MLCTensor.methods."tensorByDequantizingToType:scale:bias:".skipped = true 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-model-io/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ModelIO -------------------------------------------------------------------------------- /framework-crates/objc2-model-io/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ModelIO" 2 | crate = "objc2-model-io" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.11" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | tvos = "9.0" 8 | visionos = "1.0" 9 | 10 | # error: unknown error result type 11 | class.MDLAsset.methods."initWithURL:vertexDescriptor:bufferAllocator:preserveTopology:error:".skipped = true 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-multipeer-connectivity/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/MultipeerConnectivity -------------------------------------------------------------------------------- /framework-crates/objc2-multipeer-connectivity/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "MultipeerConnectivity" 2 | crate = "objc2-multipeer-connectivity" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "13.0" 6 | ios = "7.0" 7 | tvos = "10.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-natural-language/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/NaturalLanguage -------------------------------------------------------------------------------- /framework-crates/objc2-natural-language/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "NaturalLanguage" 2 | crate = "objc2-natural-language" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.14" 5 | maccatalyst = "13.0" 6 | ios = "12.0" 7 | tvos = "12.0" 8 | watchos = "5.0" 9 | visionos = "1.0" 10 | 11 | external.MLModel.module = "CoreML.MLModel" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-nearby-interaction/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/NearbyInteraction -------------------------------------------------------------------------------- /framework-crates/objc2-nearby-interaction/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "NearbyInteraction" 2 | crate = "objc2-nearby-interaction" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | watchos = "8.0" 8 | 9 | external.ARSession.module = "ARKit.ARSession" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-network-extension/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/NetworkExtension -------------------------------------------------------------------------------- /framework-crates/objc2-notification-center/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/NotificationCenter -------------------------------------------------------------------------------- /framework-crates/objc2-notification-center/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "NotificationCenter" 2 | crate = "objc2-notification-center" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.10" 5 | maccatalyst = "8.0" 6 | ios = "8.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-open-directory/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/OpenDirectory -------------------------------------------------------------------------------- /framework-crates/objc2-os-log/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/OSLog -------------------------------------------------------------------------------- /framework-crates/objc2-os-log/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "OSLog" 2 | crate = "objc2-os-log" 3 | required-crates = ["bitflags", "objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.15" 6 | maccatalyst = "15.0" 7 | ios = "15.0" 8 | tvos = "15.0" 9 | watchos = "8.0" 10 | visionos = "1.0" 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-osa-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/OSAKit -------------------------------------------------------------------------------- /framework-crates/objc2-osa-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "OSAKit" 2 | crate = "objc2-osa-kit" 3 | required-crates = ["objc2", "objc2-foundation", "objc2-app-kit"] 4 | custom-lib-rs = true 5 | macos = "10.4" 6 | 7 | # Needs `Component` from Core Services / Carbon Core / Component Manager 8 | class.OSALanguage.methods."initWithComponent:".skipped = true 9 | class.OSALanguage.methods.componentInstance.skipped = true 10 | class.OSALanguageInstance.methods.componentInstance.skipped = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-paravirtualized-graphics/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ParavirtualizedGraphics -------------------------------------------------------------------------------- /framework-crates/objc2-pass-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PassKit -------------------------------------------------------------------------------- /framework-crates/objc2-pdf-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PDFKit -------------------------------------------------------------------------------- /framework-crates/objc2-pdf-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PDFKit" 2 | crate = "objc2-pdf-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.4" 5 | maccatalyst = "11.0" 6 | ios = "11.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-pencil-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PencilKit -------------------------------------------------------------------------------- /framework-crates/objc2-pencil-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PencilKit" 2 | crate = "objc2-pencil-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-phase/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PHASE -------------------------------------------------------------------------------- /framework-crates/objc2-phase/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PHASE" 2 | crate = "objc2-phase" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "12.0" 6 | maccatalyst = "15.0" 7 | ios = "15.0" 8 | tvos = "15.0" 9 | visionos = "1.0" 10 | 11 | # Block uses C99 boolean 12 | class.PHASEAssetRegistry.methods."unregisterAssetWithIdentifier:completion:".skipped = true 13 | -------------------------------------------------------------------------------- /framework-crates/objc2-photos-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PhotosUI -------------------------------------------------------------------------------- /framework-crates/objc2-photos-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PhotosUI" 2 | crate = "objc2-photos-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.11" 5 | maccatalyst = "13.0" 6 | ios = "8.0" 7 | tvos = "10.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-photos/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "Bindings to the Photos/PhotoKit framework" 3 | -------------------------------------------------------------------------------- /framework-crates/objc2-photos/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Photos -------------------------------------------------------------------------------- /framework-crates/objc2-photos/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Photos" 2 | crate = "objc2-photos" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.11" 6 | maccatalyst = "13.0" 7 | ios = "8.0" 8 | tvos = "10.0" 9 | visionos = "1.0" 10 | 11 | external.NSImage.module = "AppKit.NSImage" 12 | external.UIImage.module = "UIKit.UIImage" 13 | 14 | # Needs `UIImageOrientation` from `UIKit`, but isn't configured to only be available on iOS 15 | class.PHImageManager.methods."requestImageDataForAsset:options:resultHandler:".skipped = true 16 | -------------------------------------------------------------------------------- /framework-crates/objc2-preference-panes/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PreferencePanes -------------------------------------------------------------------------------- /framework-crates/objc2-preference-panes/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PreferencePanes" 2 | crate = "objc2-preference-panes" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.1" 5 | maccatalyst = "14.0" 6 | 7 | # References static in constant. 8 | const.kNSPrefPaneHelpMenuInfoPListKey.skipped = true 9 | const.kNSPrefPaneHelpMenuTitleKey.skipped = true 10 | const.kNSPrefPaneHelpMenuAnchorKey.skipped = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-push-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PushKit -------------------------------------------------------------------------------- /framework-crates/objc2-push-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PushKit" 2 | crate = "objc2-push-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "8.0" 7 | watchos = "6.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-push-to-talk/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/PushToTalk -------------------------------------------------------------------------------- /framework-crates/objc2-push-to-talk/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "PushToTalk" 2 | crate = "objc2-push-to-talk" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "16.0" 5 | ios = "16.0" 6 | # The framework is _present_ in the macOS SDK, but it's completely empty 7 | 8 | external.UIImage.module = "UIKit.UIImage" 9 | external.AVAudioSession.module = "AVFAudio.AVAudioSession" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-quartz-core/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "Bindings to the QuartzCore/CoreAnimation framework" 3 | 4 | [features] 5 | gnustep-1-7 = [] 6 | gnustep-1-8 = [] 7 | gnustep-1-9 = [] 8 | gnustep-2-0 = [] 9 | gnustep-2-1 = [] 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-quartz-core/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/QuartzCore -------------------------------------------------------------------------------- /framework-crates/objc2-quartz/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Quartz -------------------------------------------------------------------------------- /framework-crates/objc2-quartz/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Quartz" 2 | crate = "objc2-quartz" 3 | # Depends on objc2-app-kit because all of ImageKit is basically different NSViews. 4 | required-crates = ["objc2", "objc2-foundation", "objc2-app-kit"] 5 | custom-lib-rs = true 6 | macos = "10.4" 7 | 8 | # Deprecated in macOS 10.15, uses OpenGL 9 | module.QuartzComposer.skipped = true 10 | 11 | # Moved to separate framework 12 | module.PDFKit.skipped = true 13 | module.QuickLookUI.skipped = true 14 | 15 | # Duplicate definitions 16 | class.IKImageBrowserView.methods."initWithFrame:".skipped = true 17 | -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look-thumbnailing/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/QuickLookThumbnailing -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look-thumbnailing/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "QuickLookThumbnailing" 2 | crate = "objc2-quick-look-thumbnailing" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | visionos = "1.0" 8 | 9 | external.UIImage.module = "UIKit.UIImage" 10 | external.NSImage.module = "AppKit.NSImage" 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/QuickLookUI -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "QuickLookUI" 2 | crate = "objc2-quick-look-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "12.0" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/QuickLook -------------------------------------------------------------------------------- /framework-crates/objc2-quick-look/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "QuickLook" 2 | crate = "objc2-quick-look" 3 | required-crates = ["objc2-core-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.5" 6 | maccatalyst = "13.0" 7 | ios = "4.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-replay-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ReplayKit -------------------------------------------------------------------------------- /framework-crates/objc2-replay-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ReplayKit" 2 | crate = "objc2-replay-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "13.0" 6 | ios = "9.0" 7 | tvos = "10.0" 8 | visionos = "1.0" 9 | 10 | # Belongs in ScreenCaptureKit 11 | static.SCStreamErrorDomain.skipped = true 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-safari-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SafariServices -------------------------------------------------------------------------------- /framework-crates/objc2-safari-services/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SafariServices" 2 | crate = "objc2-safari-services" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.12" 5 | maccatalyst = "13.0" 6 | ios = "7.0" 7 | visionos = "1.0" 8 | 9 | # SFSwiftOverlaySupport says these are private. 10 | static._SFSafariServicesAvailable.skipped = true 11 | static._SFSafariServicesVersion.skipped = true 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-safety-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SafetyKit -------------------------------------------------------------------------------- /framework-crates/objc2-safety-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SafetyKit" 2 | crate = "objc2-safety-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "16.1" 6 | ios = "16.0" 7 | watchos = "10.1" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-scene-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SceneKit -------------------------------------------------------------------------------- /framework-crates/objc2-screen-capture-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ScreenCaptureKit -------------------------------------------------------------------------------- /framework-crates/objc2-screen-capture-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ScreenCaptureKit" 2 | crate = "objc2-screen-capture-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "12.3" 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-screen-saver/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ScreenSaver -------------------------------------------------------------------------------- /framework-crates/objc2-screen-saver/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ScreenSaver" 2 | crate = "objc2-screen-saver" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.0" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-screen-time/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ScreenTime -------------------------------------------------------------------------------- /framework-crates/objc2-screen-time/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ScreenTime" 2 | crate = "objc2-screen-time" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | 8 | class.STScreenTimeConfigurationObserver.methods."initWithUpdateQueue:".skipped = true 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-scripting-bridge/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ScriptingBridge -------------------------------------------------------------------------------- /framework-crates/objc2-scripting-bridge/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ScriptingBridge" 2 | crate = "objc2-scripting-bridge" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.5" 5 | maccatalyst = "13.0" 6 | 7 | # Unsure what this returns. 8 | class.SBElementArray.skipped-protocols = ["NSCopying", "NSMutableCopying"] 9 | 10 | # Debug is broken in generic `objc2::extern_class!` currently. 11 | class.SBElementArray.derives = "PartialEq, Eq, Hash" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-security-foundation/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SecurityFoundation -------------------------------------------------------------------------------- /framework-crates/objc2-security-foundation/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SecurityFoundation" 2 | crate = "objc2-security-foundation" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "10.3" 6 | maccatalyst = "13.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-security-interface/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SecurityInterface -------------------------------------------------------------------------------- /framework-crates/objc2-security-interface/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SecurityInterface" 2 | crate = "objc2-security-interface" 3 | # Require AppKit, since this framework is UI-heavy, and since it allows compiling less of AppKit 4 | required-crates = ["objc2", "objc2-foundation", "objc2-app-kit"] 5 | macos = "10.3" 6 | 7 | # Uses NSCancelButton and NSOKButton, which have a different type in AppKit. 8 | const.SFButtonTypeCancel.use-value = true 9 | const.SFButtonTypeOK.use-value = true 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-security/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Security -------------------------------------------------------------------------------- /framework-crates/objc2-sensitive-content-analysis/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SensitiveContentAnalysis -------------------------------------------------------------------------------- /framework-crates/objc2-sensitive-content-analysis/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SensitiveContentAnalysis" 2 | crate = "objc2-sensitive-content-analysis" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "14.0" 5 | maccatalyst = "17.0" 6 | ios = "17.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-sensor-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SensorKit -------------------------------------------------------------------------------- /framework-crates/objc2-sensor-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SensorKit" 2 | crate = "objc2-sensor-kit" 3 | required-crates = ["objc2", "objc2-foundation", "bitflags"] 4 | ios = "14.0" 5 | 6 | # NOTE: This framework for some reason does not specify 7 | # `module * { export * }` in its module map, so it's 8 | # unfortunately emitted as a single large file. 9 | # 10 | # This is also why `bitflags` is (currently) a required dependency. 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-service-management/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ServiceManagement -------------------------------------------------------------------------------- /framework-crates/objc2-service-management/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ServiceManagement" 2 | crate = "objc2-service-management" 3 | required-crates = [] 4 | custom-lib-rs = true 5 | macos = "10.6" 6 | maccatalyst = "13.0" 7 | -------------------------------------------------------------------------------- /framework-crates/objc2-shared-with-you-core/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SharedWithYouCore -------------------------------------------------------------------------------- /framework-crates/objc2-shared-with-you-core/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SharedWithYouCore" 2 | crate = "objc2-shared-with-you-core" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | tvos = "16.0" 8 | visionos = "1.0" 9 | 10 | # Unsure why this protocol impl exists. 11 | class.SWCollaborationMetadata.skipped-protocols = ["NSMutableCopying"] 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-shared-with-you/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SharedWithYou -------------------------------------------------------------------------------- /framework-crates/objc2-shared-with-you/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SharedWithYou" 2 | crate = "objc2-shared-with-you" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "13.0" 5 | maccatalyst = "16.0" 6 | ios = "16.0" 7 | tvos = "16.0" 8 | visionos = "1.0" 9 | 10 | # Protocol impls added in SharedWithYou, but class defined in SharedWithYouCore. 11 | class.SWCollaborationMetadata.skipped-protocols = ["NSItemProviderReading", "NSItemProviderWriting"] 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-shazam-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ShazamKit -------------------------------------------------------------------------------- /framework-crates/objc2-shazam-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ShazamKit" 2 | crate = "objc2-shazam-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "12.0" 5 | maccatalyst = "15.0" 6 | ios = "15.0" 7 | tvos = "15.0" 8 | watchos = "8.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-social/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Social -------------------------------------------------------------------------------- /framework-crates/objc2-social/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Social" 2 | crate = "objc2-social" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.8" 5 | maccatalyst = "13.0" 6 | ios = "6.0" 7 | 8 | external.ACAccount.module = "Accounts.ACAccount" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-sound-analysis/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SoundAnalysis -------------------------------------------------------------------------------- /framework-crates/objc2-sound-analysis/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SoundAnalysis" 2 | crate = "objc2-sound-analysis" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "13.0" 7 | tvos = "13.0" 8 | watchos = "9.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-speech/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Speech -------------------------------------------------------------------------------- /framework-crates/objc2-speech/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Speech" 2 | crate = "objc2-speech" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | maccatalyst = "13.0" 6 | ios = "10.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-sprite-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SpriteKit -------------------------------------------------------------------------------- /framework-crates/objc2-store-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/StoreKit -------------------------------------------------------------------------------- /framework-crates/objc2-store-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "StoreKit" 2 | crate = "objc2-store-kit" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.7" 5 | maccatalyst = "13.0" 6 | ios = "3.0" 7 | tvos = "9.0" 8 | watchos = "6.2" 9 | visionos = "1.0" 10 | 11 | # Set counterparts 12 | class.SKPayment.counterpart = "MutableSubclass(StoreKit.SKPayment.SKMutablePayment)" 13 | class.SKMutablePayment.counterpart = "ImmutableSuperclass(StoreKit.SKPayment.SKPayment)" 14 | -------------------------------------------------------------------------------- /framework-crates/objc2-symbols/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Symbols -------------------------------------------------------------------------------- /framework-crates/objc2-symbols/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Symbols" 2 | crate = "objc2-symbols" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "14.0" 5 | maccatalyst = "17.0" 6 | ios = "17.0" 7 | tvos = "17.0" 8 | watchos = "10.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-system-configuration/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SystemConfiguration -------------------------------------------------------------------------------- /framework-crates/objc2-system-extensions/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/SystemExtensions -------------------------------------------------------------------------------- /framework-crates/objc2-system-extensions/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "SystemExtensions" 2 | crate = "objc2-system-extensions" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.15" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-thread-network/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/ThreadNetwork -------------------------------------------------------------------------------- /framework-crates/objc2-thread-network/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "ThreadNetwork" 2 | crate = "objc2-thread-network" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | custom-lib-rs = true 5 | macos = "13.0" 6 | maccatalyst = "16.1" 7 | ios = "15.0" 8 | visionos = "1.0" 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-tv-ml-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/TVMLKit -------------------------------------------------------------------------------- /framework-crates/objc2-tv-services/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/TVServices -------------------------------------------------------------------------------- /framework-crates/objc2-tv-services/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "TVServices" 2 | crate = "objc2-tv-services" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | tvos = "9.0" 5 | -------------------------------------------------------------------------------- /framework-crates/objc2-tv-ui-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/TVUIKit -------------------------------------------------------------------------------- /framework-crates/objc2-tv-ui-kit/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "TVUIKit" 2 | crate = "objc2-tv-ui-kit" 3 | # Require AppKit, since this framework is UI-heavy, and since it allows compiling less of AppKit 4 | required-crates = ["objc2", "objc2-foundation", "objc2-ui-kit"] 5 | tvos = "12.0" 6 | 7 | # FIXME: Make header-translator pick this up from the explicit 8 | # UIContentConfiguration protocol impl. 9 | class.TVMediaItemContentConfiguration.main-thread-only = true 10 | class.TVMonogramContentConfiguration.main-thread-only = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | # Set manually, since `CKShare` has superclass `CKRecord` 3 | objc2-cloud-kit = { workspace = true, optional = true, features = [ 4 | "CKContainer", 5 | "CKRecord", 6 | "CKShare", 7 | "CKShareMetadata", 8 | ] } 9 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/UIKit -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/gesture_recognizer.rs: -------------------------------------------------------------------------------- 1 | use objc2::extern_methods; 2 | 3 | use crate::{UIGestureRecognizer, UIGestureRecognizerState}; 4 | 5 | impl UIGestureRecognizer { 6 | extern_methods!( 7 | #[unsafe(method(state))] 8 | pub fn state(&self) -> UIGestureRecognizerState; 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/paste_configuration.rs: -------------------------------------------------------------------------------- 1 | use crate::UIPasteConfigurationSupporting; 2 | 3 | #[cfg(all( 4 | feature = "UIResponder", 5 | feature = "UIView", 6 | feature = "UIControl", 7 | feature = "UITextField", 8 | ))] 9 | unsafe impl UIPasteConfigurationSupporting for crate::UITextField {} 10 | 11 | #[cfg(all( 12 | feature = "UIResponder", 13 | feature = "UIView", 14 | feature = "UIScrollView", 15 | feature = "UITextView", 16 | ))] 17 | unsafe impl UIPasteConfigurationSupporting for crate::UITextView {} 18 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/responder.rs: -------------------------------------------------------------------------------- 1 | use objc2_foundation::NSString; 2 | 3 | extern "C" { 4 | pub static UIKeyInputF1: &'static NSString; 5 | } 6 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/tests/device.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "UIDevice")] 2 | use crate::UIDevice; 3 | use objc2_foundation::MainThreadMarker; 4 | 5 | #[test] 6 | fn current_device() { 7 | // SAFETY: This is just while testing 8 | let mtm = unsafe { MainThreadMarker::new_unchecked() }; 9 | let _device = UIDevice::currentDevice(mtm); 10 | } 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-ui-kit/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod device; 2 | -------------------------------------------------------------------------------- /framework-crates/objc2-uniform-type-identifiers/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/UniformTypeIdentifiers -------------------------------------------------------------------------------- /framework-crates/objc2-uniform-type-identifiers/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "UniformTypeIdentifiers" 2 | crate = "objc2-uniform-type-identifiers" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "14.0" 7 | tvos = "14.0" 8 | watchos = "7.0" 9 | visionos = "1.0" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-user-notifications-ui/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/UserNotificationsUI -------------------------------------------------------------------------------- /framework-crates/objc2-user-notifications-ui/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "UserNotificationsUI" 2 | crate = "objc2-user-notifications-ui" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | maccatalyst = "14.0" 6 | ios = "10.0" 7 | visionos = "1.0" 8 | 9 | external.UNNotification.module = "UserNotifications.UNNotification" 10 | external.UNNotificationResponse.module = "UserNotifications.UNNotificationResponse" 11 | external.UNNotificationAction.module = "UserNotifications.UNNotificationAction" 12 | -------------------------------------------------------------------------------- /framework-crates/objc2-user-notifications/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/UserNotifications -------------------------------------------------------------------------------- /framework-crates/objc2-video-subscriber-account/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/VideoSubscriberAccount -------------------------------------------------------------------------------- /framework-crates/objc2-video-subscriber-account/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "VideoSubscriberAccount" 2 | crate = "objc2-video-subscriber-account" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "10.14" 5 | ios = "10.0" 6 | tvos = "10.0" 7 | visionos = "1.0" 8 | 9 | external.UIViewController.module = "UIKit.UIViewController" 10 | -------------------------------------------------------------------------------- /framework-crates/objc2-video-toolbox/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/VideoToolbox -------------------------------------------------------------------------------- /framework-crates/objc2-virtualization/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Virtualization -------------------------------------------------------------------------------- /framework-crates/objc2-virtualization/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "Virtualization" 2 | crate = "objc2-virtualization" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | macos = "11.0" 5 | # Explicitly not available on Mac Catalyst (modulemap contains `requires !maccatalyst`). 6 | 7 | # Needs `ether_addr_t` 8 | class.VZMACAddress.methods."initWithEthernetAddress:".skipped = true 9 | # Needs `ether_addr_t` 10 | class.VZMACAddress.methods.ethernetAddress.skipped = true 11 | -------------------------------------------------------------------------------- /framework-crates/objc2-vision/Cargo.modified.toml: -------------------------------------------------------------------------------- 1 | [features] 2 | VNObservation = [ 3 | "objc2-foundation/NSArray", 4 | "objc2-foundation/NSData", 5 | "objc2-foundation/NSDictionary", 6 | "objc2-foundation/NSError", 7 | "objc2-foundation/NSIndexPath", 8 | "objc2-foundation/NSIndexSet", 9 | "objc2-foundation/NSObject", 10 | "objc2-foundation/NSRange", # Added 11 | "objc2-foundation/NSString", 12 | "objc2-foundation/NSUUID", 13 | "objc2-foundation/NSValue", 14 | ] 15 | -------------------------------------------------------------------------------- /framework-crates/objc2-vision/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/Vision -------------------------------------------------------------------------------- /framework-crates/objc2-watch-connectivity/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/WatchConnectivity -------------------------------------------------------------------------------- /framework-crates/objc2-watch-connectivity/translation-config.toml: -------------------------------------------------------------------------------- 1 | framework = "WatchConnectivity" 2 | crate = "objc2-watch-connectivity" 3 | required-crates = ["objc2", "objc2-foundation"] 4 | maccatalyst = "13.0" 5 | ios = "9.0" 6 | watchos = "2.0" 7 | visionos = "1.0" 8 | -------------------------------------------------------------------------------- /framework-crates/objc2-watch-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/WatchKit -------------------------------------------------------------------------------- /framework-crates/objc2-web-kit/src/generated: -------------------------------------------------------------------------------- 1 | ../../../generated/WebKit -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | # Remember to update this in ci.yml as well. 3 | channel = "nightly-2025-04-11" 4 | profile = "minimal" 5 | components = ["rustfmt", "clippy", "rust-src"] 6 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | use_field_init_shorthand = true 2 | --------------------------------------------------------------------------------