//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// **************    Immutable Dictionary    ***************
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdictionary?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(PartialEq, Eq, Hash)]
    pub struct NSDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject>;
);

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
    for NSDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSCopying for NSDictionary<KeyType, ObjectType> {}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> CopyingHelper
    for NSDictionary<KeyType, ObjectType>
{
    type Result = Self;
}

#[cfg(feature = "NSEnumerator")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
    for NSDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying
    for NSDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> MutableCopyingHelper
    for NSDictionary<KeyType, ObjectType>
{
    type Result = NSMutableDictionary<KeyType, ObjectType>;
}

unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
    for NSDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
    for NSDictionary<KeyType, ObjectType>
{
}

impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(count))]
        #[unsafe(method_family = none)]
        pub fn count(&self) -> NSUInteger;

        #[unsafe(method(objectForKey:))]
        #[unsafe(method_family = none)]
        pub fn objectForKey(&self, a_key: &KeyType) -> Option<Retained<ObjectType>>;

        #[cfg(feature = "NSEnumerator")]
        #[unsafe(method(keyEnumerator))]
        #[unsafe(method_family = none)]
        pub unsafe fn keyEnumerator(&self) -> Retained<NSEnumerator<KeyType>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSObject")]
        #[unsafe(method(initWithObjects:forKeys:count:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithObjects_forKeys_count(
            this: Allocated<Self>,
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
            cnt: NSUInteger,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl<KeyType: Message, ObjectType: Message> DefaultRetained for NSDictionary<KeyType, ObjectType> {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// NSExtendedDictionary.
impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[cfg(feature = "NSArray")]
        #[unsafe(method(allKeys))]
        #[unsafe(method_family = none)]
        pub fn allKeys(&self) -> Retained<NSArray<KeyType>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(allKeysForObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn allKeysForObject(&self, an_object: &ObjectType)
            -> Retained<NSArray<KeyType>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(allValues))]
        #[unsafe(method_family = none)]
        pub fn allValues(&self) -> Retained<NSArray<ObjectType>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(description))]
        #[unsafe(method_family = none)]
        pub unsafe fn description(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(descriptionInStringsFileFormat))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptionInStringsFileFormat(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(descriptionWithLocale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptionWithLocale(
            &self,
            locale: Option<&AnyObject>,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(descriptionWithLocale:indent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptionWithLocale_indent(
            &self,
            locale: Option<&AnyObject>,
            level: NSUInteger,
        ) -> Retained<NSString>;

        #[unsafe(method(isEqualToDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEqualToDictionary(
            &self,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
        ) -> bool;

        #[cfg(feature = "NSEnumerator")]
        #[unsafe(method(objectEnumerator))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(objectsForKeys:notFoundMarker:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectsForKeys_notFoundMarker(
            &self,
            keys: &NSArray<KeyType>,
            marker: &ObjectType,
        ) -> Retained<NSArray<ObjectType>>;

        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[unsafe(method(writeToURL:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(keysSortedByValueUsingSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn keysSortedByValueUsingSelector(
            &self,
            comparator: Sel,
        ) -> Retained<NSArray<KeyType>>;

        #[unsafe(method(getObjects:andKeys:count:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getObjects_andKeys_count(
            &self,
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<KeyType>,
            count: NSUInteger,
        );

        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectForKeyedSubscript(&self, key: &KeyType)
            -> Option<Retained<ObjectType>>;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateKeysAndObjectsUsingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateKeysAndObjectsUsingBlock(
            &self,
            block: &block2::Block<
                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
            >,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(enumerateKeysAndObjectsWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateKeysAndObjectsWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::Block<
                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
            >,
        );

        #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(keysSortedByValueUsingComparator:))]
        #[unsafe(method_family = none)]
        pub unsafe fn keysSortedByValueUsingComparator(
            &self,
            cmptr: NSComparator,
        ) -> Retained<NSArray<KeyType>>;

        #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(keysSortedByValueWithOptions:usingComparator:))]
        #[unsafe(method_family = none)]
        pub unsafe fn keysSortedByValueWithOptions_usingComparator(
            &self,
            opts: NSSortOptions,
            cmptr: NSComparator,
        ) -> Retained<NSArray<KeyType>>;

        #[cfg(all(feature = "NSSet", feature = "block2"))]
        #[unsafe(method(keysOfEntriesPassingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn keysOfEntriesPassingTest(
            &self,
            predicate: &block2::Block<
                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
            >,
        ) -> Retained<NSSet<KeyType>>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSSet", feature = "block2"))]
        #[unsafe(method(keysOfEntriesWithOptions:passingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn keysOfEntriesWithOptions_passingTest(
            &self,
            opts: NSEnumerationOptions,
            predicate: &block2::Block<
                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
            >,
        ) -> Retained<NSSet<KeyType>>;
    );
}

/// NSDeprecated.
impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        /// This method is unsafe because it could potentially cause buffer overruns. You should use -getObjects:andKeys:count:
        #[deprecated = "Use -getObjects:andKeys:count: instead"]
        #[unsafe(method(getObjects:andKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getObjects_andKeys(
            &self,
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<KeyType>,
        );

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(dictionaryWithContentsOfFile:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithContentsOfFile(
            path: &NSString,
        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(dictionaryWithContentsOfURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithContentsOfURL(
            url: &NSURL,
        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(initWithContentsOfFile:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfFile(
            this: Allocated<Self>,
            path: &NSString,
        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(initWithContentsOfURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfURL(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(writeToFile:atomically:))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeToFile_atomically(
            &self,
            path: &NSString,
            use_auxiliary_file: bool,
        ) -> bool;

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(writeToURL:atomically:))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeToURL_atomically(&self, url: &NSURL, atomically: bool) -> bool;
    );
}

/// NSDictionaryCreation.
impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(dictionary))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionary() -> Retained<Self>;

        #[cfg(feature = "NSObject")]
        #[unsafe(method(dictionaryWithObject:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObject_forKey(
            object: &ObjectType,
            key: &ProtocolObject<dyn NSCopying>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSObject")]
        #[unsafe(method(dictionaryWithObjects:forKeys:count:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObjects_forKeys_count(
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
            cnt: NSUInteger,
        ) -> Retained<Self>;

        #[unsafe(method(dictionaryWithDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithDictionary(
            dict: &NSDictionary<KeyType, ObjectType>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
        #[unsafe(method(dictionaryWithObjects:forKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObjects_forKeys(
            objects: &NSArray<ObjectType>,
            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithDictionary:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDictionary(
            this: Allocated<Self>,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithDictionary:copyItems:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDictionary_copyItems(
            this: Allocated<Self>,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
            flag: bool,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
        #[unsafe(method(initWithObjects:forKeys:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithObjects_forKeys(
            this: Allocated<Self>,
            objects: &NSArray<ObjectType>,
            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSDictionary`.
///
/// NSDictionaryCreation.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(dictionary))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionary() -> Retained<Self>;

        #[cfg(feature = "NSObject")]
        #[unsafe(method(dictionaryWithObject:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObject_forKey(
            object: &ObjectType,
            key: &ProtocolObject<dyn NSCopying>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSObject")]
        #[unsafe(method(dictionaryWithObjects:forKeys:count:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObjects_forKeys_count(
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
            cnt: NSUInteger,
        ) -> Retained<Self>;

        #[unsafe(method(dictionaryWithDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithDictionary(
            dict: &NSDictionary<KeyType, ObjectType>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
        #[unsafe(method(dictionaryWithObjects:forKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithObjects_forKeys(
            objects: &NSArray<ObjectType>,
            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithDictionary:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDictionary(
            this: Allocated<Self>,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithDictionary:copyItems:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDictionary_copyItems(
            this: Allocated<Self>,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
            flag: bool,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
        #[unsafe(method(initWithObjects:forKeys:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithObjects_forKeys(
            this: Allocated<Self>,
            objects: &NSArray<ObjectType>,
            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
        ) -> Retained<Self>;
    );
}

extern_class!(
    /// **************    Mutable Dictionary    ***************
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutabledictionary?language=objc)
    #[unsafe(super(NSDictionary<KeyType, ObjectType, >, NSObject))]
    #[derive(PartialEq, Eq, Hash)]
    pub struct NSMutableDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject>;
);

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
    for NSMutableDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSCopying
    for NSMutableDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> CopyingHelper
    for NSMutableDictionary<KeyType, ObjectType>
{
    type Result = NSDictionary<KeyType, ObjectType>;
}

#[cfg(feature = "NSEnumerator")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
    for NSMutableDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying
    for NSMutableDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> MutableCopyingHelper
    for NSMutableDictionary<KeyType, ObjectType>
{
    type Result = Self;
}

unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
    for NSMutableDictionary<KeyType, ObjectType>
{
}

#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
    for NSMutableDictionary<KeyType, ObjectType>
{
}

impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(removeObjectForKey:))]
        #[unsafe(method_family = none)]
        pub fn removeObjectForKey(&self, a_key: &KeyType);

        #[cfg(feature = "NSObject")]
        #[unsafe(method(setObject:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_forKey(
            &self,
            an_object: &ObjectType,
            a_key: &ProtocolObject<dyn NSCopying>,
        );

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initWithCapacity:))]
        #[unsafe(method_family = init)]
        pub fn initWithCapacity(this: Allocated<Self>, num_items: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSDictionary`.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[cfg(feature = "NSObject")]
        #[unsafe(method(initWithObjects:forKeys:count:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithObjects_forKeys_count(
            this: Allocated<Self>,
            objects: *mut NonNull<ObjectType>,
            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
            cnt: NSUInteger,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl<KeyType: Message, ObjectType: Message> DefaultRetained
    for NSMutableDictionary<KeyType, ObjectType>
{
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// NSExtendedMutableDictionary.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(addEntriesFromDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addEntriesFromDictionary(
            &self,
            other_dictionary: &NSDictionary<KeyType, ObjectType>,
        );

        #[unsafe(method(removeAllObjects))]
        #[unsafe(method_family = none)]
        pub fn removeAllObjects(&self);

        #[cfg(feature = "NSArray")]
        #[unsafe(method(removeObjectsForKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeObjectsForKeys(&self, key_array: &NSArray<KeyType>);

        #[unsafe(method(setDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDictionary(&self, other_dictionary: &NSDictionary<KeyType, ObjectType>);

        #[cfg(feature = "NSObject")]
        #[unsafe(method(setObject:forKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_forKeyedSubscript(
            &self,
            obj: Option<&ObjectType>,
            key: &ProtocolObject<dyn NSCopying>,
        );
    );
}

/// NSMutableDictionaryCreation.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(dictionaryWithCapacity:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithCapacity(num_items: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(dictionaryWithContentsOfFile:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithContentsOfFile(
            path: &NSString,
        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(dictionaryWithContentsOfURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithContentsOfURL(
            url: &NSURL,
        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContentsOfFile:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfFile(
            this: Allocated<Self>,
            path: &NSString,
        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(initWithContentsOfURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfURL(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
    );
}

/// NSSharedKeySetDictionary.
impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
        #[unsafe(method(sharedKeySetForKeys:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedKeySetForKeys(
            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
        ) -> Retained<AnyObject>;
    );
}

/// NSSharedKeySetDictionary.
impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
    extern_methods!(
        #[unsafe(method(dictionaryWithSharedKeySet:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryWithSharedKeySet(
            keyset: &AnyObject,
        ) -> Retained<NSMutableDictionary<KeyType, ObjectType>>;
    );
}
