AI-generated Key Takeaways
-
SearchSuggestionsViewControllersimplifies the integration ofSearchSuggestionsViewwithin UIKit applications. -
It requires instantiation, addition to a view controller, view embedding, and search suggestions assignment for rendering.
-
The class exposes properties for customization options (
customizationOptions), search suggestions data (searchSuggestions), and the underlying view (view).
SearchSuggestionsViewController
@available(iOS, introduced: 14)
@objc
@objcMembers
class SearchSuggestionsViewControllerA class to make it easier to use the SearchSuggestionsView in UIKit applications.
The way this is to be included in a UIViewController is to:
- Create an instance of a SearchSuggestionsViewController with a specified customization option
_searchSuggestionsViewController = [[SearchSuggestionsViewController alloc] initWithCustomizationOption: [[SearchSuggestionsViewCustomizationOption alloc] init]]; - Add this to the view controller
[_searchSuggestionsViewController addToViewController:self]; - Add its view to the parent view
[self.view addSubview:_searchSuggestionsViewController.view]; - Assign search suggestions to it to render those search suggestions.
dispatch_async(dispatch_get_main_queue(), ^{ _searchSuggestionsViewController.searchSuggestions = _searchSuggestions; }
-
The customization options of the search suggestions view.
Declaration
Swift
@available(iOS, introduced: 14) @objc var customizationOptions: SearchSuggestionsViewOptions { get set } -
The search suggestions used to generate the UI.
Declaration
Swift
@available(iOS, introduced: 14) @objc var searchSuggestions: SearchSuggestions? { get set } -
The UIView of the search suggestions which is converted from the hostingController’s SwiftUI rootview.
Declaration
Swift
@available(iOS, introduced: 14) @objc var view: UIView { get }