SearchConfig
public struct SearchConfig
Search configuration value type
-
maximum number of matches allowed
Declaration
Swift
public let maxMatches: MatchCount? -
types of fragments allowed
Declaration
Swift
public let fragment: FragmentType -
generic payload for custom patterns to use
Declaration
Swift
public let userData: Any? -
init with fragment, maxMatches and userData
Declaration
Swift
public init(fragment: FragmentType = .all, maxMatches: MatchCount? = nil, userData: Any? = nil)
-
allow all search results
Declaration
Swift
static let all = SearchConfig() -
allow matched region results only
Declaration
Swift
static let matches = SearchConfig(fragment: .match) -
allow match and sub-match results only
Declaration
Swift
static let deepMatches = SearchConfig(fragment: .allMatch) -
allow only one match result
Declaration
Swift
static let firstMatch = SearchConfig(fragment: .allMatch, maxMatches: 1) -
allow only unmatched region results
Declaration
Swift
static let text = SearchConfig(fragment: .text) -
allow only matched and unmatched (but not sub-match) results
Declaration
Swift
static let shallow = SearchConfig(fragment: [.match, .text])
-
checks if the new match count is allowed by this configuration
Declaration
Swift
func allows(matchCount count: MatchCount) -> Bool -
get a new configuration with the new match count
Declaration
Swift
func set(maxMatches value: MatchCount) -> SearchConfig -
get a new configuration with the new fragment types allowed
Declaration
Swift
func set(fragment value: FragmentType) -> SearchConfig -
get a new configuration without the given fragment type
Declaration
Swift
func remove(fragment removed: FragmentType) -> SearchConfig
SearchConfig Structure Reference