2 * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
26 #import <UIKit/UIKit.h>
28 #if USE(APPLE_INTERNAL_SDK)
30 #import <UIKit/UIAlertController_Private.h>
31 #import <UIKit/UIApplication_Private.h>
32 #import <UIKit/UIBarButtonItem_Private.h>
33 #import <UIKit/UIBlurEffect_Private.h>
34 #import <UIKit/UICalloutBar.h>
35 #import <UIKit/UIColorEffect.h>
36 #import <UIKit/UIDatePicker_Private.h>
37 #import <UIKit/UIDevice_Private.h>
38 #import <UIKit/UIDocumentMenuViewController_Private.h>
39 #import <UIKit/UIDocumentPasswordView.h>
40 #import <UIKit/UIFont_Private.h>
41 #import <UIKit/UIGeometry_Private.h>
42 #import <UIKit/UIGestureRecognizer_Private.h>
43 #import <UIKit/UIImagePickerController_Private.h>
44 #import <UIKit/UIImage_Private.h>
45 #import <UIKit/UIInterface_Private.h>
46 #import <UIKit/UIKeyboardImpl.h>
47 #import <UIKit/UIKeyboardIntl.h>
48 #import <UIKit/UIKeyboard_Private.h>
49 #import <UIKit/UILongPressGestureRecognizer_Private.h>
50 #import <UIKit/UIPeripheralHost.h>
51 #import <UIKit/UIPeripheralHost_Private.h>
52 #import <UIKit/UIPickerContentView_Private.h>
53 #import <UIKit/UIPickerView_Private.h>
54 #import <UIKit/UIPresentationController_Private.h>
55 #import <UIKit/UIResponder_Private.h>
56 #import <UIKit/UIScrollView_Private.h>
57 #import <UIKit/UIStringDrawing_Private.h>
58 #import <UIKit/UITableViewCell_Private.h>
59 #import <UIKit/UITapGestureRecognizer_Private.h>
60 #import <UIKit/UITextEffectsWindow.h>
61 #import <UIKit/UITextInput_Private.h>
62 #import <UIKit/UITextInteractionAssistant_Private.h>
63 #import <UIKit/UIViewControllerTransitioning_Private.h>
64 #import <UIKit/UIViewController_Private.h>
65 #import <UIKit/UIViewController_ViewService.h>
66 #import <UIKit/UIView_Private.h>
67 #import <UIKit/UIVisualEffect_Private.h>
68 #import <UIKit/UIWKSelectionAssistant.h>
69 #import <UIKit/UIWKTextInteractionAssistant.h>
70 #import <UIKit/UIWebBrowserView.h>
71 #import <UIKit/UIWebDocumentView.h>
72 #import <UIKit/UIWebFormAccessory.h>
73 #import <UIKit/UIWebGeolocationPolicyDecider.h>
74 #import <UIKit/UIWebScrollView.h>
75 #import <UIKit/UIWebTiledView.h>
76 #import <UIKit/UIWebTouchEventsGestureRecognizer.h>
77 #import <UIKit/UIWindow_Private.h>
78 #import <UIKit/_UIBackdropViewSettings.h>
79 #import <UIKit/_UIBackdropView_Private.h>
80 #import <UIKit/_UIHighlightView.h>
81 #import <UIKit/_UINavigationInteractiveTransition.h>
82 #import <UIKit/_UINavigationParallaxTransition.h>
84 #if HAVE(LINK_PREVIEW)
85 #import <UIKit/UIPreviewItemController.h>
88 #if ENABLE(DRAG_SUPPORT)
89 #import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
90 #import <UIKit/UIItemProvider_Private.h>
93 #if ENABLE(DRAG_SUPPORT)
94 #import <UIKit/UIDragInteraction.h>
95 #import <UIKit/UIDragInteraction_Private.h>
96 #import <UIKit/UIDragItem_Private.h>
97 #import <UIKit/UIDragPreviewParameters.h>
98 #import <UIKit/UIDragPreview_Private.h>
99 #import <UIKit/UIDragSession.h>
100 #import <UIKit/UIDragging.h>
101 #import <UIKit/UIDropInteraction.h>
102 #import <UIKit/UIPreviewInteraction.h>
103 #import <UIKit/UIURLDragPreviewView.h>
104 #import <UIKit/_UITextDragCaretView.h>
109 #if ENABLE(DRAG_SUPPORT)
110 #import <UIKit/NSItemProvider+UIKitAdditions.h>
113 #if HAVE(LINK_PREVIEW)
114 typedef NS_ENUM(NSInteger, UIPreviewItemType) {
115 UIPreviewItemTypeNone,
116 UIPreviewItemTypeClientCustom,
117 UIPreviewItemTypeLink,
118 UIPreviewItemTypeImage,
119 UIPreviewItemTypeText,
120 UIPreviewItemTypeAttachment,
123 @class UIPreviewItemController;
125 @protocol UIPreviewItemDelegate <NSObject>
126 - (NSDictionary *)_dataForPreviewItemController:(UIPreviewItemController *)controller atPosition:(CGPoint)position type:(UIPreviewItemType *)type;
128 - (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position;
129 - (void)_interactionStartedFromPreviewItemController:(UIPreviewItemController *)controller;
130 - (void)_interactionStoppedFromPreviewItemController:(UIPreviewItemController *)controller;
131 - (UIViewController *)_presentedViewControllerForPreviewItemController:(UIPreviewItemController *)controller;
132 - (void)_previewItemController:(UIPreviewItemController *)controller didDismissPreview:(UIViewController *)viewController committing:(BOOL)committing;
133 - (void)_previewItemController:(UIPreviewItemController *)controller commitPreview:(UIViewController *)viewController;
134 - (void)_previewItemControllerDidCancelPreview:(UIPreviewItemController *)controller;
135 - (UIImage *)_presentationSnapshotForPreviewItemController:(UIPreviewItemController *)controller;
136 - (NSArray *)_presentationRectsForPreviewItemController:(UIPreviewItemController *)controller;
137 - (CGRect)_presentationRectForPreviewItemController:(UIPreviewItemController *)controller;
140 @interface UIPreviewItemController : NSObject
141 - (instancetype)initWithView:(UIView *)view;
142 @property (assign, nonatomic) id<UIPreviewItemDelegate> delegate;
143 @property (assign, nonatomic, readonly) UIPreviewItemType type;
144 @property (strong, nonatomic, readonly) NSDictionary *previewData;
145 @property (strong, nonatomic, readonly) UIGestureRecognizer *presentationGestureRecognizer;
146 @property (strong, nonatomic, readonly) UIGestureRecognizer *presentationSecondaryGestureRecognizer;
150 @interface UIAlertController ()
151 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler;
152 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler shouldDismissHandler:(BOOL (^)(void))shouldDismissHandler;
153 @property (nonatomic) UIAlertControllerStyle preferredStyle;
156 @interface UIApplication ()
157 - (UIInterfaceOrientation)interfaceOrientation;
158 - (void)_cancelAllTouches;
159 - (CGFloat)statusBarHeight;
160 - (BOOL)isSuspendedUnderLock;
163 typedef NS_ENUM(NSInteger, UIDatePickerPrivateMode) {
164 UIDatePickerModeYearAndMonth = 4269,
167 @interface UIDatePicker ()
168 @property (nonatomic, readonly, getter=_contentWidth) CGFloat contentWidth;
171 @interface UIDevice ()
172 @property (nonatomic, readonly, retain) NSString *buildVersion;
176 kUIKeyboardInputRepeat = 1 << 0,
177 kUIKeyboardInputPopupVariant = 1 << 1,
178 kUIKeyboardInputMultitap = 1 << 2,
179 kUIKeyboardInputSkipCandidateSelection = 1 << 3,
180 kUIKeyboardInputDeadKey = 1 << 4,
181 kUIKeyboardInputModifierFlagsChanged = 1 << 5,
182 kUIKeyboardInputFlick = 1 << 6,
183 kUIKeyboardInputPreProcessed = 1 << 7,
184 } UIKeyboardInputFlags;
186 @interface UIEvent ()
187 @property (nonatomic, readonly) UIKeyboardInputFlags _inputFlags;
189 - (NSString *)_unmodifiedInput;
190 - (NSString *)_modifiedInput;
191 - (NSInteger)_modifierFlags;
196 UIFontTraitPlain = 0x00000000,
200 + (UIFont *)fontWithFamilyName:(NSString *)familyName traits:(UIFontTrait)traits size:(CGFloat)fontSize;
207 @interface UIImagePickerController ()
208 @property (nonatomic, setter=_setAllowsMultipleSelection:) BOOL _allowsMultipleSelection;
211 @interface UIImage ()
212 - (id)initWithCGImage:(CGImageRef)CGImage imageOrientation:(UIImageOrientation)imageOrientation;
215 @interface UIKeyCommand ()
216 @property (nonatomic, readonly) UIEvent *_triggeringEvent;
219 @protocol UIKeyboardImplGeometryDelegate
220 @property (nonatomic, readwrite, getter=isMinimized) BOOL minimized;
221 - (void)prepareForImplBoundsHeightChange:(CGFloat)endDelta suppressNotification:(BOOL)suppressNotification;
222 - (void)implBoundsHeightChangeDone:(CGFloat)endDelta suppressNotification:(BOOL)suppressNotification;
223 - (BOOL)shouldSaveMinimizationState;
228 @protocol UIKeyboardCandidateListDelegate <NSObject>
230 - (void)setCandidateList:(id)candidateList updateCandidateView:(BOOL)updateCandidateView;
231 - (void)candidateListAcceptCandidate:(id)candidateList;
232 - (void)candidateListSelectionDidChange:(id)candidateList;
233 - (void)candidateListShouldBeDismissed:(id)candidateList;
236 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=173341
237 #ifndef _WEBKIT_UIKITSPI_UIKEYBOARD
238 #define _WEBKIT_UIKITSPI_UIKEYBOARD 1
239 @interface UIKeyboard : UIView <UIKeyboardImplGeometryDelegate>
243 @interface UIKeyboard ()
244 + (CGSize)defaultSizeForInterfaceOrientation:(UIInterfaceOrientation)orientation;
246 - (void)geometryChangeDone:(BOOL)keyboardVisible;
247 - (void)prepareForGeometryChange;
250 @interface UIKeyboardImpl : UIView <UIKeyboardCandidateListDelegate>
253 @interface UIKeyboardImpl ()
254 + (UIKeyboardImpl *)activeInstance;
255 + (UIKeyboardImpl *)sharedInstance;
256 + (CGSize)defaultSizeForInterfaceOrientation:(UIInterfaceOrientation)orientation;
257 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags;
258 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags withInputManagerHint:(NSString *)hint;
259 - (BOOL)autocorrectSpellingEnabled;
260 - (void)deleteFromInput;
261 - (void)deleteFromInputWithFlags:(NSUInteger)flags;
262 - (void)replaceText:(id)replacement;
263 @property (nonatomic, readwrite, retain) UIResponder <UIKeyInput> *delegate;
266 @interface UILongPressGestureRecognizer ()
267 @property (nonatomic) CFTimeInterval delay;
268 @property (nonatomic, readonly) CGPoint startPoint;
269 @property (nonatomic, assign, setter=_setRequiresQuietImpulse:) BOOL _requiresQuietImpulse;
272 @interface _UIWebHighlightLongPressGestureRecognizer : UILongPressGestureRecognizer
275 @interface _UIWebHighlightLongPressGestureRecognizer ()
279 @interface UIPeripheralHost : NSObject <UIGestureRecognizerDelegate>
282 @class UIKeyboardRotationState;
284 @interface UIPeripheralHost ()
285 + (UIPeripheralHost *)sharedInstance;
286 + (UIPeripheralHost *)activeInstance;
287 + (CGRect)visiblePeripheralFrame;
289 - (UIKeyboardRotationState *)rotationState;
292 @interface UIPickerContentView : UIView
295 @interface UIPickerContentView ()
296 +(CGFloat)_checkmarkOffset;
297 -(CGFloat)labelWidthForBounds:(CGRect)bounds;
298 @property (nonatomic, getter=isChecked) BOOL checked;
299 @property (nonatomic, readonly) UILabel *titleLabel;
302 @interface UIPickerView ()
303 + (CGSize)defaultSizeForCurrentOrientation;
304 - (void)_setUsesCheckedSelection:(BOOL)usesCheckedSelection;
305 @property (nonatomic, setter=_setMagnifierEnabled:) BOOL _magnifierEnabled;
308 @interface UIResponder ()
309 - (void)_handleKeyUIEvent:(UIEvent *)event;
310 - (void)_wheelChangedWithEvent:(UIEvent *)event;
314 @interface UIScreen ()
315 - (CADisplay *)_display;
318 @interface UIScrollView ()
319 - (void)_stopScrollingAndZoomingAnimations;
320 - (void)_zoomToCenter:(CGPoint)center scale:(CGFloat)scale duration:(CFTimeInterval)duration force:(BOOL)force;
321 - (void)_zoomToCenter:(CGPoint)center scale:(CGFloat)scale duration:(CFTimeInterval)duration;
322 @property (nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
323 @property (nonatomic, readonly, getter=_isAnimatingZoom) BOOL isAnimatingZoom;
324 @property (nonatomic, readonly, getter=_isAnimatingScroll) BOOL isAnimatingScroll;
325 @property (nonatomic) CGFloat horizontalScrollDecelerationFactor;
326 @property (nonatomic) CGFloat verticalScrollDecelerationFactor;
327 @property (nonatomic, readonly) BOOL _isInterruptingDeceleration;
328 @property (nonatomic, getter=_contentScrollInset, setter=_setContentScrollInset:) UIEdgeInsets contentScrollInset;
329 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
330 @property (nonatomic, readonly) UIEdgeInsets _systemContentInset;
334 @interface NSString (UIKitDetails)
335 - (CGSize)_legacy_sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;
336 - (CGSize)_legacy_sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;
339 @interface UITapGestureRecognizer ()
340 @property (nonatomic, getter=_allowableSeparation, setter=_setAllowableSeparation:) CGFloat allowableSeparation;
341 @property (nonatomic, readonly) CGPoint location;
342 @property (nonatomic) CGFloat allowableMovement;
343 @property (nonatomic, readonly) CGPoint centroid;
349 UITextShortcutConversionTypeDefault = 0,
350 UITextShortcutConversionTypeNo = 1,
351 UITextShortcutConversionTypeYes = 2,
352 } UITextShortcutConversionType;
354 @protocol UITextInputTraits_Private <NSObject, UITextInputTraits>
355 - (void)takeTraitsFrom:(id <UITextInputTraits>)traits;
357 @property (nonatomic) UITextShortcutConversionType shortcutConversionType;
360 @class UITextInputArrowKeyHistory;
362 @protocol UITextInputPrivate <UITextInput, UITextInputTokenizer, UITextInputTraits_Private>
364 - (BOOL)requiresKeyEvents;
365 - (NSArray *)metadataDictionariesForDictationResults;
366 - (UIColor *)textColorForCaretSelection;
367 - (UIFont *)fontForCaretSelection;
368 - (UIView *)automaticallySelectedOverlay;
369 - (void)handleKeyWebEvent:(WebEvent *)event;
370 - (void)insertDictationResult:(NSArray *)dictationResult withCorrectionIdentifier:(id)correctionIdentifier;
371 - (void)replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text;
372 - (void)setBottomBufferHeight:(CGFloat)bottomBuffer;
373 @property (nonatomic) UITextGranularity selectionGranularity;
376 - (BOOL)hasSelection;
380 @interface UITextInputTraits : NSObject <UITextInputTraits, UITextInputTraits_Private, NSCopying>
383 @interface UITextInteractionAssistant : NSObject
386 @interface UITextInteractionAssistant ()
387 - (void)activateSelection;
388 - (void)deactivateSelection;
389 - (void)didEndScrollingOverflow;
390 - (void)selectionChanged;
391 - (void)setGestureRecognizers;
392 - (void)willStartScrollingOverflow;
395 @interface UITextSuggestion : NSObject
398 @protocol UITextInputSuggestionDelegate <UITextInputDelegate>
399 - (void)setSuggestions:(NSArray <UITextSuggestion*> *)suggestions;
402 @interface UIViewController ()
403 + (UIViewController *)_viewControllerForFullScreenPresentationFromView:(UIView *)view;
404 + (UIViewController *)viewControllerForView:(UIView *)view;
407 @interface UIViewController (ViewService)
408 - (pid_t)_hostProcessIdentifier;
409 @property (readonly) NSString *_hostApplicationBundleIdentifier;
412 @protocol UIViewControllerContextTransitioningEx <UIViewControllerContextTransitioning>
413 - (void)__runAlongsideAnimations;
414 - (void)_interactivityDidChange:(BOOL)isInteractive;
415 @property (nonatomic, assign, setter=_setAllowUserInteraction:, getter=_allowUserInteraction) BOOL _allowUserInteraction;
416 @property (nonatomic, assign, setter=_setPercentOffset:) CGFloat _percentOffset;
417 @property (nonatomic, retain, setter=_setContainerViews:) NSArray *_containerViews;
420 @interface _UIViewControllerTransitionContext : NSObject <UIViewControllerContextTransitioningEx>
423 // FIXME: Separate the parts we are simply re-declaring from the ones we are overriding.
424 @interface _UIViewControllerTransitionContext (Details)
425 - (void) _setTransitionIsInFlight:(BOOL)flag;
426 @property (nonatomic, assign, setter=_setAllowUserInteraction:, getter=_allowUserInteraction) BOOL _allowUserInteraction;
427 @property (nonatomic, assign, setter=_setAnimator:) id <UIViewControllerAnimatedTransitioning> _animator;
428 @property (nonatomic, assign, setter=_setContainerView:) UIView *containerView;
429 @property (nonatomic, assign, setter=_setInteractor:) id <UIViewControllerInteractiveTransitioning> _interactor;
430 @property (nonatomic, assign, setter=_setPercentOffset:) CGFloat _percentOffset;
431 @property (nonatomic, copy, setter=_setCompletionHandler:) void (^_completionHandler)(_UIViewControllerTransitionContext *context, BOOL transitionCompleted);
432 @property (nonatomic, retain, setter=_setContainerViews:) NSArray *_containerViews;
435 @interface _UIViewControllerOneToOneTransitionContext : _UIViewControllerTransitionContext
438 @interface _UIViewControllerOneToOneTransitionContext ()
439 @property (nonatomic, assign, setter=_setFromEndFrame:) CGRect fromEndFrame;
440 @property (nonatomic, assign, setter=_setFromStartFrame:) CGRect fromStartFrame;
441 @property (nonatomic, assign, setter=_setToEndFrame:) CGRect toEndFrame;
442 @property (nonatomic, assign, setter=_setToStartFrame:) CGRect toStartFrame;
443 @property (nonatomic, retain, setter=_setFromViewController:) UIViewController *fromViewController;
444 @property (nonatomic, retain, setter=_setToViewController:) UIViewController *toViewController;
447 @protocol UIViewControllerAnimatedTransitioningEx <UIViewControllerAnimatedTransitioning>
448 - (BOOL)interactionAborted;
449 - (UINavigationControllerOperation) operation;
450 - (UIPercentDrivenInteractiveTransition *)interactionController;
451 - (void)setInteractionAborted:(BOOL)aborted;
452 - (void)setInteractionController:(UIPercentDrivenInteractiveTransition *)controller;
453 - (void)setOperation:(UINavigationControllerOperation)operation;
455 - (UIWindow *)window;
458 typedef NS_ENUM (NSInteger, _UIBackdropMaskViewFlags) {
459 _UIBackdropMaskViewNone = 0,
460 _UIBackdropMaskViewGrayscaleTint = 1 << 0,
461 _UIBackdropMaskViewColorTint = 1 << 1,
462 _UIBackdropMaskViewFilters = 1 << 2,
463 _UIBackdropMaskViewAll = _UIBackdropMaskViewGrayscaleTint | _UIBackdropMaskViewColorTint | _UIBackdropMaskViewFilters,
467 + (BOOL)_isInAnimationBlock;
469 - (void)setFrameOrigin:(CGPoint)origin;
470 - (void)setSize:(CGSize)size;
471 @property (nonatomic, assign, setter=_setBackdropMaskViewFlags:) NSInteger _backdropMaskViewFlags;
472 - (void)_populateArchivedSubviews:(NSMutableSet *)encodedViews;
473 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
474 - (void)safeAreaInsetsDidChange;
476 @property (nonatomic, setter=_setContinuousCornerRadius:) CGFloat _continuousCornerRadius;
479 @interface UIWebSelectionView : UIView
482 @interface UIWebSelectionAssistant : NSObject <UIGestureRecognizerDelegate>
485 @protocol UISelectionInteractionAssistant
486 - (void)showSelectionCommands;
489 @interface UIWebSelectionAssistant ()
490 - (BOOL)isSelectionGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
491 - (id)initWithView:(UIView *)view;
492 - (void)clearSelection;
493 - (void)didEndScrollingOrZoomingPage;
494 - (void)didEndScrollingOverflow;
495 - (void)resignedFirstResponder;
496 - (void)selectionChanged;
497 - (void)setGestureRecognizers;
498 - (void)willStartScrollingOrZoomingPage;
499 - (void)willStartScrollingOverflow;
500 @property (nonatomic, retain) UIWebSelectionView *selectionView;
501 @property (nonatomic, readonly) CGRect selectionFrame;
504 typedef NS_ENUM(NSInteger, UIWKSelectionTouch) {
505 UIWKSelectionTouchStarted = 0,
506 UIWKSelectionTouchMoved = 1,
507 UIWKSelectionTouchEnded = 2,
508 UIWKSelectionTouchEndedMovingForward = 3,
509 UIWKSelectionTouchEndedMovingBackward = 4,
510 UIWKSelectionTouchEndedNotMoving = 5,
513 typedef NS_ENUM(NSInteger, UIWKSelectionFlags) {
515 UIWKWordIsNearTap = 1,
516 UIWKPhraseBoundaryChanged = 4,
519 typedef NS_ENUM(NSInteger, UIWKGestureType) {
520 UIWKGestureLoupe = 0,
521 UIWKGestureOneFingerTap = 1,
522 UIWKGestureTapAndAHalf = 2,
523 UIWKGestureDoubleTap = 3,
524 UIWKGestureTapAndHalf = 4,
525 UIWKGestureDoubleTapInUneditable = 5,
526 UIWKGestureOneFingerTapInUneditable = 6,
527 UIWKGestureOneFingerTapSelectsAll = 7,
528 UIWKGestureOneFingerDoubleTap = 8,
529 UIWKGestureOneFingerTripleTap = 9,
530 UIWKGestureTwoFingerSingleTap = 10,
531 UIWKGestureTwoFingerRangedSelectGesture = 11,
532 UIWKGestureTapOnLinkWithGesture = 12,
533 UIWKGestureMakeWebSelection = 13,
534 UIWKGesturePhraseBoundary = 14,
537 @interface UIWKSelectionAssistant : UIWebSelectionAssistant
540 @interface UIWKSelectionAssistant ()
541 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
542 - (void)blockSelectionChangedWithTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags growThreshold:(CGFloat)grow shrinkThreshold:(CGFloat)shrink;
544 - (BOOL)shouldHandleSingleTapAtPoint:(CGPoint)point;
545 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
546 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags;
547 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
548 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
549 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
550 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;
551 @property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer;
554 @interface UIWKAutocorrectionRects : NSObject
557 @interface UIWKAutocorrectionRects (UIWKAutocorrectionRectsDetails)
558 @property (nonatomic, assign) CGRect firstRect;
559 @property (nonatomic, assign) CGRect lastRect;
562 @interface UIWKAutocorrectionContext : NSObject
565 @interface UIWKAutocorrectionContext (UIWKAutocorrectionContextDetails)
566 @property (nonatomic, copy) NSString *contextBeforeSelection;
567 @property (nonatomic, copy) NSString *selectedText;
568 @property (nonatomic, copy) NSString *contextAfterSelection;
569 @property (nonatomic, copy) NSString *markedText;
570 @property (nonatomic, assign) NSRange rangeInMarkedText;
573 @interface UIWKTextInteractionAssistant : UITextInteractionAssistant <UIResponderStandardEditActions>
576 @interface UIWKTextInteractionAssistant ()
577 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
578 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
579 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags;
580 - (void)showTextStyleOptions;
581 - (void)hideTextStyleOptions;
582 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;
583 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
584 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
585 - (void)scheduleReplacementsForText:(NSString *)text;
586 - (void)scheduleChineseTransliterationForText:(NSString *)text;
588 @property (nonatomic, readonly, assign) UILongPressGestureRecognizer *loupeGesture;
589 @property (nonatomic, readonly, assign) UITapGestureRecognizer *singleTapGesture;
592 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
593 typedef NS_ENUM(NSInteger, UIWKHandlePosition) {
596 UIWKHandleBottom = 2,
601 @protocol UIWKInteractionViewProtocol
602 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state;
603 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart withFlags:(UIWKSelectionFlags)flags;
604 - (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState;
605 - (CGRect)textFirstRect;
606 - (CGRect)textLastRect;
608 - (void)requestAutocorrectionContextWithCompletionHandler:(void (^)(UIWKAutocorrectionContext *autocorrectionContext))completionHandler;
610 - (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
612 - (void)applyAutocorrection:(NSString *)correction toString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForCorrection))completionHandler;
614 - (NSString *)markedText;
615 - (BOOL)hasMarkedText;
617 - (BOOL)hasSelectablePositionAtPoint:(CGPoint)point;
618 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110000
619 - (BOOL)pointIsInAssistedNode:(CGPoint)point;
621 - (NSArray *)webSelectionRects;
622 - (void)_cancelLongPressGestureRecognizer;
625 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
626 - (void)changeBlockSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch forHandle:(UIWKHandlePosition)handle;
629 - (void)clearSelection;
630 - (void)replaceDictatedText:(NSString *)oldText withText:(NSString *)newText;
631 - (void)requestDictationContext:(void (^)(NSString *selectedText, NSString *prefixText, NSString *postfixText))completionHandler;
632 - (BOOL)pointIsNearMarkedText:(CGPoint)point;
633 - (NSString *)selectedText;
634 - (void)replaceText:(NSString *)text withText:(NSString *)word;
635 - (void)selectWordForReplacement;
636 - (BOOL)isReplaceAllowed;
637 - (void)selectWordBackward;
638 - (UIView *)unscaledView;
639 - (CGFloat)inverseScale;
640 - (CGRect)unobscuredContentRect;
643 @protocol UITextAutoscrolling
644 - (void)startAutoscroll:(CGPoint)point;
645 - (void)cancelAutoscroll;
646 - (void)scrollSelectionToVisible:(BOOL)animated;
650 @protocol UIWebFormAccessoryDelegate;
652 @interface UIWebFormAccessory : UIInputView
655 @interface UIWebFormAccessory ()
656 - (void)hideAutoFillButton;
657 - (void)setClearVisible:(BOOL)flag;
658 - (void)showAutoFillButtonWithTitle:(NSString *)title;
659 @property (nonatomic, retain) UIBarButtonItem *_autofill;
660 @property (nonatomic, assign) id <UIWebFormAccessoryDelegate> delegate;
662 @property (nonatomic, assign, getter=isNextEnabled) BOOL nextEnabled;
663 @property (nonatomic, assign, getter=isPreviousEnabled) BOOL previousEnabled;
664 - (id)initWithInputAssistantItem:(UITextInputAssistantItem *)inputAssistantItem;
667 @protocol UIWebFormAccessoryDelegate
668 - (void)accessoryAutoFill;
669 - (void)accessoryClear;
670 - (void)accessoryDone;
671 - (void)accessoryTab:(BOOL)isNext;
674 @interface UIWebGeolocationPolicyDecider : NSObject
677 @interface UIWebGeolocationPolicyDecider ()
678 + (instancetype)sharedPolicyDecider;
679 - (void)decidePolicyForGeolocationRequestFromOrigin:(id)securityOrigin requestingURL:(NSURL *)requestingURL window:(UIWindow *)window listener:(id)listener;
683 UIWebTouchEventTouchBegin = 0,
684 UIWebTouchEventTouchChange = 1,
685 UIWebTouchEventTouchEnd = 2,
686 UIWebTouchEventTouchCancel = 3,
687 } UIWebTouchEventType;
690 UIWebTouchPointTypeDirect = 0,
691 UIWebTouchPointTypeStylus
692 } UIWebTouchPointType;
694 struct _UIWebTouchPoint {
695 CGPoint locationInScreenCoordinates;
696 CGPoint locationInDocumentCoordinates;
699 #if __IPHONE_OS_VERSION_MIN_REQUIRED > 100000
700 CGFloat majorRadiusInScreenCoordinates;
702 CGFloat altitudeAngle;
703 CGFloat azimuthAngle;
704 UIWebTouchPointType touchType;
708 struct _UIWebTouchEvent {
709 UIWebTouchEventType type;
710 NSTimeInterval timestamp;
711 CGPoint locationInScreenCoordinates;
712 CGPoint locationInDocumentCoordinates;
716 bool inJavaScriptGesture;
718 struct _UIWebTouchPoint* touchPoints;
719 unsigned touchPointCount;
724 @class UIWebTouchEventsGestureRecognizer;
726 @protocol UIWebTouchEventsGestureRecognizerDelegate <NSObject>
727 - (BOOL)isAnyTouchOverActiveArea:(NSSet *)touches;
729 - (BOOL)gestureRecognizer:(UIWebTouchEventsGestureRecognizer *)gestureRecognizer shouldIgnoreWebTouchWithEvent:(UIEvent *)event;
732 @interface UIWebTouchEventsGestureRecognizer : UIGestureRecognizer
735 @interface UIWebTouchEventsGestureRecognizer ()
736 - (id)initWithTarget:(id)target action:(SEL)action touchDelegate:(id <UIWebTouchEventsGestureRecognizerDelegate>)delegate;
737 @property (nonatomic, getter=isDefaultPrevented) BOOL defaultPrevented;
738 @property (nonatomic, readonly) BOOL inJavaScriptGesture;
739 @property (nonatomic, readonly) CGPoint locationInWindow;
740 @property (nonatomic, readonly) UIWebTouchEventType type;
741 @property (nonatomic, readonly) const struct _UIWebTouchEvent *lastTouchEvent;
744 typedef NS_ENUM(NSInteger, _UIBackdropViewStylePrivate) {
745 _UIBackdropViewStyle_Light = 2020,
746 _UIBackdropViewStyle_Dark = 2030
749 @interface _UIBackdropViewSettings : NSObject
752 @interface _UIBackdropViewSettings ()
753 + (_UIBackdropViewSettings *)settingsForPrivateStyle:(_UIBackdropViewStylePrivate)style;
754 @property (nonatomic, assign) CGFloat scale;
757 @interface _UIBackdropView : UIView
760 @interface _UIBackdropView ()
761 - (instancetype)initWithPrivateStyle:(_UIBackdropViewStylePrivate)style;
762 - (instancetype)initWithSettings:(_UIBackdropViewSettings *)settings;
763 - (instancetype)initWithFrame:(CGRect)frame privateStyle:(_UIBackdropViewStylePrivate)style;
764 @property (nonatomic, strong, readonly) UIView *contentView;
767 @interface _UIHighlightView : UIView
770 @interface _UIHighlightView ()
771 - (void)setColor:(UIColor *)aColor;
772 - (void)setCornerRadii:(NSArray *)cornerRadii;
773 - (void)setCornerRadius:(CGFloat)aCornerRadius;
774 - (void)setFrames:(NSArray *)frames boundaryRect:(CGRect)aBoundarRect;
775 - (void)setQuads:(NSArray *)quads boundaryRect:(CGRect)aBoundaryRect;
778 @interface _UINavigationParallaxTransition : NSObject <UIViewControllerAnimatedTransitioningEx>
781 @interface _UINavigationParallaxTransition ()
782 - (instancetype) initWithCurrentOperation:(UINavigationControllerOperation)operation;
785 @protocol _UINavigationInteractiveTransitionBaseDelegate;
787 @interface _UINavigationInteractiveTransitionBase : UIPercentDrivenInteractiveTransition <UIGestureRecognizerDelegate>
790 @interface _UINavigationInteractiveTransitionBase ()
791 - (id)initWithGestureRecognizerView:(UIView *)gestureRecognizerView animator:(id<UIViewControllerAnimatedTransitioning>)animator delegate:(id<_UINavigationInteractiveTransitionBaseDelegate>)delegate;
792 - (void)_completeStoppedInteractiveTransition;
793 @property (nonatomic, weak) UIPanGestureRecognizer *gestureRecognizer;
794 @property (nonatomic, assign) BOOL shouldReverseTranslation;
795 @property (nonatomic, retain) _UINavigationParallaxTransition *animationController;
798 @protocol _UINavigationInteractiveTransitionBaseDelegate <NSObject>
799 - (void)startInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition;
800 - (BOOL)shouldBeginInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition;
801 - (BOOL)interactiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
802 - (BOOL)interactiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
803 - (UIPanGestureRecognizer *)gestureRecognizerForInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition WithTarget:(id)target action:(SEL)action;
806 @class BKSAnimationFenceHandle;
808 @interface UIWindow ()
809 + (BKSAnimationFenceHandle *)_synchronizedDrawingFence;
810 + (mach_port_t)_synchronizeDrawingAcrossProcesses;
811 - (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
814 @interface UIWebScrollView : UIScrollView
817 @interface UIWebTiledView : UIView
822 @interface UIWebTiledView ()
823 - (void)setWAKWindow:(WAKWindow *)window;
826 @interface UIWebDocumentView : UIWebTiledView
830 UIEveryDocumentMask = 0xFFFFFF,
833 @interface UIWebDocumentView ()
834 - (void)setDelegate:(id)delegate;
835 - (void)setAutoresizes:(BOOL)flag;
836 - (void)setMinimumSize:(CGSize)aSize;
837 - (void)setInitialScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
838 - (void)setViewportSize:(CGSize)aSize forDocumentTypes:(UIDocumentMask)aDocumentMask;
839 - (void)setMinimumScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
840 - (void)setMaximumScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
843 @interface UIWebBrowserView : UIWebDocumentView
848 @interface UIWebBrowserView ()
849 - (WebView *)webView;
850 - (void)setPaused:(BOOL)paused;
851 - (void)sendScrollEventIfNecessaryWasUserScroll:(BOOL)userScroll;
852 @property (nonatomic) BOOL inputViewObeysDOMFocus;
855 @interface UIDocumentMenuViewController ()
856 - (instancetype)_initIgnoringApplicationEntitlementForImportOfTypes:(NSArray *)types;
859 @protocol UIDocumentPasswordViewDelegate;
861 @interface UIDocumentPasswordView : UIView <UITextFieldDelegate>
864 @interface UIDocumentPasswordView ()
866 - (id)initWithDocumentName:(NSString *)documentName;
868 @property (nonatomic, assign) NSObject<UIDocumentPasswordViewDelegate> *passwordDelegate;
869 @property (nonatomic, readonly) UITextField *passwordField;
873 @protocol UIDocumentPasswordViewDelegate
877 - (void)userDidEnterPassword:(NSString *)password forPasswordView:(UIDocumentPasswordView *)passwordView;
881 - (void)didBeginEditingPassword:(UITextField *)passwordField inView:(UIDocumentPasswordView *)passwordView;
882 - (void)didEndEditingPassword:(UITextField *)passwordField inView:(UIDocumentPasswordView *)passwordView;
886 @interface UIViewControllerPreviewAction : NSObject <NSCopying>
889 @interface UIViewControllerPreviewAction ()
890 + (instancetype)actionWithTitle:(NSString *)title handler:(void (^)(UIViewControllerPreviewAction *action, UIViewController *previewViewController))handler;
893 #if ENABLE(DRAG_SUPPORT)
895 @interface UIItemProvider : NSItemProvider
900 NSTimeInterval _UIDragInteractionDefaultLiftDelay(void);
901 CGFloat UIRoundToScreenScale(CGFloat value, UIScreen *);
905 typedef NS_OPTIONS(NSUInteger, UIDragOperation)
907 UIDragOperationNone = 0,
908 UIDragOperationEvery = NSUIntegerMax,
911 @interface UIDragInteraction ()
912 @property (nonatomic, assign, getter=_liftDelay, setter=_setLiftDelay:) NSTimeInterval liftDelay;
915 @interface UIDragItem ()
916 @property (nonatomic, strong, setter=_setPrivateLocalContext:, getter=_privateLocalContext) id privateLocalContext;
919 @protocol UITextInput;
920 @interface _UITextDragCaretView : UIView
921 - (instancetype)initWithTextInputView:(UIView<UITextInput> *)textInputView;
922 -(void)insertAtPosition:(UITextPosition *)position;
923 -(void)updateToPosition:(UITextPosition *)position;
927 @interface UICalloutBar : UIView
928 + (void)fadeSharedCalloutBar;
931 @interface UIApplicationRotationFollowingWindow : UIWindow
933 @interface UIAutoRotatingWindow : UIApplicationRotationFollowingWindow
936 @interface UITextEffectsWindow : UIAutoRotatingWindow
937 + (UITextEffectsWindow *)sharedTextEffectsWindow;
940 @interface UIURLDragPreviewView : UIView
941 + (instancetype)viewWithTitle:(NSString *)title URL:(NSURL *)url;
946 @interface _UIVisualEffectLayerConfig : NSObject
947 + (instancetype)layerWithFillColor:(UIColor *)fillColor opacity:(CGFloat)opacity filterType:(NSString *)filterType;
948 - (void)configureLayerView:(UIView *)view;
951 @interface _UIVisualEffectConfig : NSObject
952 @property (nonatomic, readonly) _UIVisualEffectLayerConfig *contentConfig;
953 + (_UIVisualEffectConfig *)configWithContentConfig:(_UIVisualEffectLayerConfig *)contentConfig;
956 @interface UIVisualEffect ()
957 + (UIVisualEffect *)emptyEffect;
958 + (UIVisualEffect *)effectCombiningEffects:(NSArray<UIVisualEffect *> *)effects;
961 @interface UIColorEffect : UIVisualEffect
962 + (UIColorEffect *)colorEffectSaturate:(CGFloat)saturationAmount;
965 @interface UIBlurEffect ()
966 + (UIBlurEffect *)effectWithBlurRadius:(CGFloat)blurRadius;
969 #endif // USE(APPLE_INTERNAL_SDK)
971 @interface UIColor (IPI)
972 + (UIColor *)insertionPointColor;
975 @interface UIView (IPI)
976 - (UIScrollView *)_scroller;
977 - (CGPoint)accessibilityConvertPointFromSceneReferenceCoordinates:(CGPoint)point;
978 - (CGRect)accessibilityConvertRectToSceneReferenceCoordinates:(CGRect)rect;
979 - (UIRectEdge)_edgesApplyingSafeAreaInsetsToContentInset;
982 @interface UIPeripheralHost (IPI)
983 - (void)_beginIgnoringReloadInputViews;
984 - (int)_endIgnoringReloadInputViews;
985 - (void)forceReloadInputViews;
988 #if __has_include(<UIKit/UITextInputMultiDocument.h>)
989 #import <UIKit/UITextInputMultiDocument.h>
991 @protocol UITextInputMultiDocument <NSObject>
993 - (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token completion:(void (^)(BOOL didRestore))completion;
994 - (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively;
998 @interface UIResponder ()
999 - (UIResponder *)firstResponder;
1002 @interface _UINavigationInteractiveTransitionBase ()
1003 - (void)_stopInteractiveTransition;
1006 #if __has_include(<UIKit/UITextAutofillSuggestion.h>)
1007 #import <UIKit/UITextAutofillSuggestion.h>
1009 @interface UITextAutofillSuggestion : UITextSuggestion
1010 @property (nonatomic, assign) NSString *username;
1011 @property (nonatomic, assign) NSString *password;
1015 static inline bool currentUserInterfaceIdiomIsPad()
1017 // This inline function exists to thwart unreachable code
1018 // detection on platforms where UICurrentUserInterfaceIdiomIsPad
1019 // is defined directly to false.
1020 #if USE(APPLE_INTERNAL_SDK)
1021 return UICurrentUserInterfaceIdiomIsPad();
1023 return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
1029 BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts(void);
1030 BOOL UIKeyboardEnabledInputModesAllowChineseTransliterationForText(NSString *);
1031 BOOL UIKeyboardCurrentInputModeAllowsChineseOrJapaneseReanalysisForText(NSString *);
1033 extern const float UITableCellDefaultFontSize;
1034 extern const float UITableViewCellDefaultFontSize;
1036 extern NSString * const UIWindowDidMoveToScreenNotification;
1037 extern NSString * const UIWindowDidRotateNotification;
1038 extern NSString * const UIWindowNewScreenUserInfoKey;
1039 extern NSString * const UIWindowWillRotateNotification;
1041 extern NSString * const UIKeyboardIsLocalUserInfoKey;
1043 extern UIApplication *UIApp;
1044 BOOL _UIApplicationIsExtension(void);
1045 void _UIApplicationLoadWebKit(void);
1047 void UIImageDataWriteToSavedPhotosAlbum(NSData *imageData, id completionTarget, SEL completionSelector, void *contextInfo);
1049 UIImage* _UIImageGetWebKitPhotoLibraryIcon(void);
1050 UIImage* _UIImageGetWebKitTakePhotoOrVideoIcon(void);
1052 extern const float UIWebViewGrowsAndShrinksToFitHeight;
1053 extern const float UIWebViewScalesToFitScale;
1054 extern const float UIWebViewStandardViewportWidth;
1056 extern NSString *const UIKeyInputPageUp;
1057 extern NSString *const UIKeyInputPageDown;
1059 extern const NSString *UIPreviewDataLink;
1060 extern const NSString *UIPreviewDataDDResult;
1061 extern const NSString *UIPreviewDataDDContext;
1063 extern const NSString *UIPreviewDataAttachmentList;
1064 extern const NSString *UIPreviewDataAttachmentIndex;
1066 extern NSString * const UIPreviewDataAttachmentListSourceIsManaged;
1068 UIEdgeInsets UIEdgeInsetsAdd(UIEdgeInsets lhs, UIEdgeInsets rhs, UIRectEdge);