objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
//! 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 objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingoptionkey?language=objc)
// NS_TYPED_ENUM
pub type NSTextCheckingOptionKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingorthographykey?language=objc)
    pub static NSTextCheckingOrthographyKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingquoteskey?language=objc)
    pub static NSTextCheckingQuotesKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingreplacementskey?language=objc)
    pub static NSTextCheckingReplacementsKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingreferencedatekey?language=objc)
    pub static NSTextCheckingReferenceDateKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingreferencetimezonekey?language=objc)
    pub static NSTextCheckingReferenceTimeZoneKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingdocumenturlkey?language=objc)
    pub static NSTextCheckingDocumentURLKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingdocumenttitlekey?language=objc)
    pub static NSTextCheckingDocumentTitleKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingdocumentauthorkey?language=objc)
    pub static NSTextCheckingDocumentAuthorKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingregularexpressionskey?language=objc)
    pub static NSTextCheckingRegularExpressionsKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingselectedrangekey?language=objc)
    pub static NSTextCheckingSelectedRangeKey: &'static NSTextCheckingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckinggenerateinlinepredictionskey?language=objc)
    pub static NSTextCheckingGenerateInlinePredictionsKey: &'static NSTextCheckingOptionKey;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscorrectionresponse?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCorrectionResponse(pub NSInteger);
impl NSCorrectionResponse {
    #[doc(alias = "NSCorrectionResponseNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSCorrectionResponseAccepted")]
    pub const Accepted: Self = Self(1);
    #[doc(alias = "NSCorrectionResponseRejected")]
    pub const Rejected: Self = Self(2);
    #[doc(alias = "NSCorrectionResponseIgnored")]
    pub const Ignored: Self = Self(3);
    #[doc(alias = "NSCorrectionResponseEdited")]
    pub const Edited: Self = Self(4);
    #[doc(alias = "NSCorrectionResponseReverted")]
    pub const Reverted: Self = Self(5);
}

unsafe impl Encode for NSCorrectionResponse {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSCorrectionResponse {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscorrectionindicatortype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCorrectionIndicatorType(pub NSInteger);
impl NSCorrectionIndicatorType {
    #[doc(alias = "NSCorrectionIndicatorTypeDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "NSCorrectionIndicatorTypeReversion")]
    pub const Reversion: Self = Self(1);
    #[doc(alias = "NSCorrectionIndicatorTypeGuesses")]
    pub const Guesses: Self = Self(2);
}

unsafe impl Encode for NSCorrectionIndicatorType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSCorrectionIndicatorType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellchecker?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSSpellChecker;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSSpellChecker {}
);

impl NSSpellChecker {
    extern_methods!(
        #[unsafe(method(sharedSpellChecker))]
        #[unsafe(method_family = none)]
        pub fn sharedSpellChecker() -> Retained<NSSpellChecker>;

        #[unsafe(method(sharedSpellCheckerExists))]
        #[unsafe(method_family = none)]
        pub fn sharedSpellCheckerExists() -> bool;

        #[unsafe(method(uniqueSpellDocumentTag))]
        #[unsafe(method_family = none)]
        pub fn uniqueSpellDocumentTag() -> NSInteger;

        /// # Safety
        ///
        /// `word_count` must be a valid pointer or null.
        #[unsafe(method(checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount(
            &self,
            string_to_check: &NSString,
            starting_offset: NSInteger,
            language: Option<&NSString>,
            wrap_flag: bool,
            tag: NSInteger,
            word_count: *mut NSInteger,
        ) -> NSRange;

        #[unsafe(method(checkSpellingOfString:startingAt:))]
        #[unsafe(method_family = none)]
        pub fn checkSpellingOfString_startingAt(
            &self,
            string_to_check: &NSString,
            starting_offset: NSInteger,
        ) -> NSRange;

        #[unsafe(method(countWordsInString:language:))]
        #[unsafe(method_family = none)]
        pub fn countWordsInString_language(
            &self,
            string_to_count: &NSString,
            language: Option<&NSString>,
        ) -> NSInteger;

        /// # Safety
        ///
        /// `details` generic generic should be of the correct type.
        #[unsafe(method(checkGrammarOfString:startingAt:language:wrap:inSpellDocumentWithTag:details:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkGrammarOfString_startingAt_language_wrap_inSpellDocumentWithTag_details(
            &self,
            string_to_check: &NSString,
            starting_offset: NSInteger,
            language: Option<&NSString>,
            wrap_flag: bool,
            tag: NSInteger,
            details: Option<&mut Option<Retained<NSArray<NSDictionary<NSString, AnyObject>>>>>,
        ) -> NSRange;

        /// # Safety
        ///
        /// - `options` generic should be of the correct type.
        /// - `word_count` must be a valid pointer or null.
        #[unsafe(method(checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkString_range_types_options_inSpellDocumentWithTag_orthography_wordCount(
            &self,
            string_to_check: &NSString,
            range: NSRange,
            checking_types: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, AnyObject>>,
            tag: NSInteger,
            orthography: Option<&mut Option<Retained<NSOrthography>>>,
            word_count: *mut NSInteger,
        ) -> Retained<NSArray<NSTextCheckingResult>>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(requestCheckingOfString:range:types:options:inSpellDocumentWithTag:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestCheckingOfString_range_types_options_inSpellDocumentWithTag_completionHandler(
            &self,
            string_to_check: &NSString,
            range: NSRange,
            checking_types: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, AnyObject>>,
            tag: NSInteger,
            completion_handler: Option<
                &block2::DynBlock<
                    dyn Fn(
                        NSInteger,
                        NonNull<NSArray<NSTextCheckingResult>>,
                        NonNull<NSOrthography>,
                        NSInteger,
                    ),
                >,
            >,
        ) -> NSInteger;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(requestCandidatesForSelectedRange:inString:types:options:inSpellDocumentWithTag:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestCandidatesForSelectedRange_inString_types_options_inSpellDocumentWithTag_completionHandler(
            &self,
            selected_range: NSRange,
            string_to_check: &NSString,
            checking_types: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, AnyObject>>,
            tag: NSInteger,
            completion_handler: Option<
                &block2::DynBlock<dyn Fn(NSInteger, NonNull<NSArray<NSTextCheckingResult>>)>,
            >,
        ) -> NSInteger;

        #[cfg(all(feature = "NSMenu", feature = "NSResponder", feature = "NSView"))]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(menuForResult:string:options:atLocation:inView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn menuForResult_string_options_atLocation_inView(
            &self,
            result: &NSTextCheckingResult,
            checked_string: &NSString,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, AnyObject>>,
            location: NSPoint,
            view: &NSView,
        ) -> Option<Retained<NSMenu>>;

        #[unsafe(method(userQuotesArrayForLanguage:))]
        #[unsafe(method_family = none)]
        pub fn userQuotesArrayForLanguage(
            &self,
            language: &NSString,
        ) -> Retained<NSArray<NSString>>;

        #[unsafe(method(userReplacementsDictionary))]
        #[unsafe(method_family = none)]
        pub fn userReplacementsDictionary(&self) -> Retained<NSDictionary<NSString, NSString>>;

        #[unsafe(method(updateSpellingPanelWithMisspelledWord:))]
        #[unsafe(method_family = none)]
        pub fn updateSpellingPanelWithMisspelledWord(&self, word: &NSString);

        /// # Safety
        ///
        /// `detail` generic should be of the correct type.
        #[unsafe(method(updateSpellingPanelWithGrammarString:detail:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateSpellingPanelWithGrammarString_detail(
            &self,
            string: &NSString,
            detail: &NSDictionary<NSString, AnyObject>,
        );

        #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
        #[unsafe(method(spellingPanel))]
        #[unsafe(method_family = none)]
        pub fn spellingPanel(&self, mtm: MainThreadMarker) -> Retained<NSPanel>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(accessoryView))]
        #[unsafe(method_family = none)]
        pub fn accessoryView(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        /// Setter for [`accessoryView`][Self::accessoryView].
        #[unsafe(method(setAccessoryView:))]
        #[unsafe(method_family = none)]
        pub fn setAccessoryView(&self, accessory_view: Option<&NSView>);

        #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
        #[unsafe(method(substitutionsPanel))]
        #[unsafe(method_family = none)]
        pub fn substitutionsPanel(&self, mtm: MainThreadMarker) -> Retained<NSPanel>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[unsafe(method(substitutionsPanelAccessoryViewController))]
        #[unsafe(method_family = none)]
        pub fn substitutionsPanelAccessoryViewController(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSViewController>>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// Setter for [`substitutionsPanelAccessoryViewController`][Self::substitutionsPanelAccessoryViewController].
        #[unsafe(method(setSubstitutionsPanelAccessoryViewController:))]
        #[unsafe(method_family = none)]
        pub fn setSubstitutionsPanelAccessoryViewController(
            &self,
            substitutions_panel_accessory_view_controller: Option<&NSViewController>,
        );

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

        #[unsafe(method(ignoreWord:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn ignoreWord_inSpellDocumentWithTag(&self, word_to_ignore: &NSString, tag: NSInteger);

        #[unsafe(method(ignoredWordsInSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn ignoredWordsInSpellDocumentWithTag(
            &self,
            tag: NSInteger,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(setIgnoredWords:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn setIgnoredWords_inSpellDocumentWithTag(
            &self,
            words: &NSArray<NSString>,
            tag: NSInteger,
        );

        #[unsafe(method(guessesForWordRange:inString:language:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn guessesForWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(correctionForWordRange:inString:language:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn correctionForWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: &NSString,
            tag: NSInteger,
        ) -> Option<Retained<NSString>>;

        #[unsafe(method(completionsForPartialWordRange:inString:language:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn completionsForPartialWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(languageForWordRange:inString:orthography:))]
        #[unsafe(method_family = none)]
        pub fn languageForWordRange_inString_orthography(
            &self,
            range: NSRange,
            string: &NSString,
            orthography: Option<&NSOrthography>,
        ) -> Option<Retained<NSString>>;

        #[unsafe(method(closeSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn closeSpellDocumentWithTag(&self, tag: NSInteger);

        #[unsafe(method(recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:))]
        #[unsafe(method_family = none)]
        pub fn recordResponse_toCorrection_forWord_language_inSpellDocumentWithTag(
            &self,
            response: NSCorrectionResponse,
            correction: &NSString,
            word: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSView", feature = "block2"))]
        #[unsafe(method(showCorrectionIndicatorOfType:primaryString:alternativeStrings:forStringInRect:view:completionHandler:))]
        #[unsafe(method_family = none)]
        pub fn showCorrectionIndicatorOfType_primaryString_alternativeStrings_forStringInRect_view_completionHandler(
            &self,
            r#type: NSCorrectionIndicatorType,
            primary_string: &NSString,
            alternative_strings: &NSArray<NSString>,
            rect_of_typed_string: NSRect,
            view: &NSView,
            completion_block: Option<&block2::DynBlock<dyn Fn(*mut NSString)>>,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(dismissCorrectionIndicatorForView:))]
        #[unsafe(method_family = none)]
        pub fn dismissCorrectionIndicatorForView(&self, view: &NSView);

        #[cfg(feature = "NSTextInputClient")]
        #[unsafe(method(showInlinePredictionForCandidates:client:))]
        #[unsafe(method_family = none)]
        pub fn showInlinePredictionForCandidates_client(
            &self,
            candidates: &NSArray<NSTextCheckingResult>,
            client: &ProtocolObject<dyn NSTextInputClient>,
        );

        #[unsafe(method(preventsAutocorrectionBeforeString:language:))]
        #[unsafe(method_family = none)]
        pub fn preventsAutocorrectionBeforeString_language(
            &self,
            string: &NSString,
            language: Option<&NSString>,
        ) -> bool;

        #[unsafe(method(deletesAutospaceBetweenString:andString:language:))]
        #[unsafe(method_family = none)]
        pub fn deletesAutospaceBetweenString_andString_language(
            &self,
            preceding_string: &NSString,
            following_string: &NSString,
            language: Option<&NSString>,
        ) -> bool;

        #[unsafe(method(availableLanguages))]
        #[unsafe(method_family = none)]
        pub fn availableLanguages(&self) -> Retained<NSArray<NSString>>;

        #[unsafe(method(userPreferredLanguages))]
        #[unsafe(method_family = none)]
        pub fn userPreferredLanguages(&self) -> Retained<NSArray<NSString>>;

        #[unsafe(method(automaticallyIdentifiesLanguages))]
        #[unsafe(method_family = none)]
        pub fn automaticallyIdentifiesLanguages(&self) -> bool;

        /// Setter for [`automaticallyIdentifiesLanguages`][Self::automaticallyIdentifiesLanguages].
        #[unsafe(method(setAutomaticallyIdentifiesLanguages:))]
        #[unsafe(method_family = none)]
        pub fn setAutomaticallyIdentifiesLanguages(&self, automatically_identifies_languages: bool);

        #[unsafe(method(setWordFieldStringValue:))]
        #[unsafe(method_family = none)]
        pub fn setWordFieldStringValue(&self, string: &NSString);

        #[unsafe(method(learnWord:))]
        #[unsafe(method_family = none)]
        pub fn learnWord(&self, word: &NSString);

        #[unsafe(method(hasLearnedWord:))]
        #[unsafe(method_family = none)]
        pub fn hasLearnedWord(&self, word: &NSString) -> bool;

        #[unsafe(method(unlearnWord:))]
        #[unsafe(method_family = none)]
        pub fn unlearnWord(&self, word: &NSString);

        #[unsafe(method(isAutomaticTextReplacementEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticTextReplacementEnabled() -> bool;

        #[unsafe(method(isAutomaticSpellingCorrectionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticSpellingCorrectionEnabled() -> bool;

        #[unsafe(method(isAutomaticQuoteSubstitutionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticQuoteSubstitutionEnabled() -> bool;

        #[unsafe(method(isAutomaticDashSubstitutionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticDashSubstitutionEnabled() -> bool;

        #[unsafe(method(isAutomaticCapitalizationEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticCapitalizationEnabled() -> bool;

        #[unsafe(method(isAutomaticPeriodSubstitutionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticPeriodSubstitutionEnabled() -> bool;

        #[unsafe(method(isAutomaticTextCompletionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticTextCompletionEnabled() -> bool;

        #[unsafe(method(isAutomaticInlinePredictionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isAutomaticInlinePredictionEnabled() -> bool;

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

        #[unsafe(method(setLanguage:))]
        #[unsafe(method_family = none)]
        pub fn setLanguage(&self, language: &NSString) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSSpellChecker {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSSpellChecker {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticspellingcorrectionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomatictextreplacementnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticTextReplacementNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticquotesubstitutionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticdashsubstitutionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticcapitalizationnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticCapitalizationNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticperiodsubstitutionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticPeriodSubstitutionNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomatictextcompletionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticTextCompletionNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspellcheckerdidchangeautomaticinlinepredictionnotification?language=objc)
    pub static NSSpellCheckerDidChangeAutomaticInlinePredictionNotification:
        &'static NSNotificationName;
}

/// NSDeprecated.
impl NSSpellChecker {
    extern_methods!(
        /// # Safety
        ///
        /// `word` might not allow `None`.
        #[deprecated = "Use -guessesForWordRange:inString:language:inSpellDocumentWithTag instead"]
        #[unsafe(method(guessesForWord:))]
        #[unsafe(method_family = none)]
        pub unsafe fn guessesForWord(&self, word: Option<&NSString>) -> Option<Retained<NSArray>>;

        /// # Safety
        ///
        /// `word` might not allow `None`.
        #[deprecated]
        #[unsafe(method(forgetWord:))]
        #[unsafe(method_family = none)]
        pub unsafe fn forgetWord(&self, word: Option<&NSString>);
    );
}