Skip to content

Commit

Permalink
Use makeURL(fromSuggestionPhrase: as URL factory
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroboron committed Apr 4, 2024
1 parent 85010b1 commit 44d41b1
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions DuckDuckGo/AutocompleteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,7 @@ class AutocompleteViewController: UIViewController {
selectedItem = -1
tableView.reloadData()

loader = SuggestionLoader(dataSource: self, urlFactory: { phrase in
guard let url = URL(trimmedAddressBarString: phrase),
let scheme = url.scheme,
scheme.description.hasPrefix("http"),
url.isValid else {
return nil
}

return url
})
loader = SuggestionLoader(dataSource: self, urlFactory: URL.makeURL(fromSuggestionPhrase:))
pendingRequest = true

loader?.getSuggestions(query: query) { [weak self] result, error in
Expand Down

0 comments on commit 44d41b1

Please sign in to comment.