AI-generated Key Takeaways
-
SearchContentViewControllersimplifies the integration ofSearchContentViewwithin UIKit applications. -
It provides properties to customize the search content view (
customizationOptions), access its underlying view (view), and manage search content data (blockData,searchContents). -
To use it, create an instance, add it to your view controller, incorporate its view, and assign search content for display.
-
Initialization is done using
initWithOptions:, requiringSearchSuggestionsViewOptionsfor customization.
SearchContentViewController
@interface SearchContentViewController : NSObjectA class to make it easier to use the SearchContentView in UIKit applications. The way this is to be included in a UIViewController is to:
-
Create an instance of a SearchContentViewController with a specified customization option
_searchContentViewController = [[SearchContentViewController alloc] initWithCustomizationOption: [[SearchContentViewCustomizationOption alloc] init]]; -
Add this to the view controller
[_searchContentViewController addToViewController:self]; -
Add its view to the parent view
[self.view addSubview:_searchContentViewController.view]; -
Assign search contents to it to render search content.
dispatch_async(dispatch_get_main_queue(), ^{ _searchContentViewController.searchContents = _searchContents; }
-
The customization options of the search content view.
Declaration
Objective-C
@property (nonatomic, strong) SearchSuggestionsViewOptions *_Nonnull customizationOptions; -
The UIView of the search content which is converted from the hostingController’s SwiftUI rootview.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIView *_Nonnull view; -
The search content block data used to generate the UI.
Declaration
Objective-C
@property (nonatomic, strong) SearchContentBlockData *_Nullable blockData; -
Undocumented
Declaration
Objective-C
- (nonnull instancetype)initWithOptions:(SearchSuggestionsViewOptions * _Nonnull)options OBJC_DESIGNATED_INITIALIZER; -
Undocumented
Declaration
Objective-C
- (void)addToViewController:(UIViewController * _Nonnull)controller; -
Unavailable
Undocumented
Declaration
Objective-C
- (nonnull instancetype)init SWIFT_UNAVAILABLE; -
Unavailable
-init is unavailable
Undocumented
Declaration
Objective-C
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");