Swiftpack.co - LaurentiuUngur/LUAutocompleteView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by LaurentiuUngur.
LaurentiuUngur/LUAutocompleteView 5.0.0
Highly configurable autocomplete view that is attachable to any UITextField
⭐️ 54
🕓 5 weeks ago
.package(url: "https://github.com/LaurentiuUngur/LUAutocompleteView.git", from: "5.0.0")


Easy to use and highly configurable autocomplete view that is attachable to any UITextField

Swift 5 Swift Package Manager compatible Pod Version Pod Platform Pod License



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ sudo gem install cocoapods

CocoaPods 1.13.0+ is required.

To integrate LUAutocompleteView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'

target '<Your Target Name>' do
    pod 'LUAutocompleteView'

Then, run the following command:

$ pod install

Swift Package Manager

To integrate using Apple's Swift Package Manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/LaurentiuUngur/LUAutocompleteView", from: Version(5, 0, 0))


If you prefer not to use either of the before mentioned dependency managers, you can integrate LUAutocompleteView into your project manually.


  • Import LUAutocompleteView into your project.
import LUAutocompleteView
  • Add autocomplete view as subview
  • Assign to textField property the text field to which the autocomplete view you want be attached.
autocompleteView.textField = textField
  • Set as data source and delegate.
autocompleteView.dataSource = self
autocompleteView.delegate = self
  • Implement LUAutocompleteViewDataSource and LUAutocompleteViewDelegate protocols.
// MARK: - LUAutocompleteViewDataSource

extension ViewController: LUAutocompleteViewDataSource {
    func autocompleteView(_ autocompleteView: LUAutocompleteView, elementsFor text: String, completion: @escaping ([String]) -> Void) {
        let elementsThatMatchInput = elements.filter { $0.lowercased().contains(text.lowercased()) }

// MARK: - LUAutocompleteViewDelegate

extension ViewController: LUAutocompleteViewDelegate {
    func autocompleteView(_ autocompleteView: LUAutocompleteView, didSelect text: String) {
        print(text + " was selected from autocomplete view")


  • Create your custom autocomplete cell by subclassing LUAutocompleteTableViewCell.
  • Override func set(text: String) from LUAutocompleteTableViewCell that is called every time when given text should be displayed by the cell.
import UIKit
import LUAutocompleteView

final class CustomAutocompleteTableViewCell: LUAutocompleteTableViewCell {
    // MARK: - Base Class Overrides

    override func set(text: String) {
        textLabel?.text = text
        textLabel?.textColor = .red
  • Assign to autocompleteCell property your custom autocomplete cell.
autocompleteView.autocompleteCell = CustomAutocompleteTableViewCell.self

For more usage details please see example app


  • Xcode 15.0+
  • Swift 5.9+
  • iOS 13.0+



  • LUAutocompleteView is available under the MIT license.


Stars: 54
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

5 weeks ago
  • Swift 5.9 and Xcode 15 support
  • Drop Carthage support
  • Drop support below iOS 13

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics