在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):LaurentiuUngur/LUAutocompleteView开源软件地址(OpenSource Url):https://github.com/LaurentiuUngur/LUAutocompleteView开源编程语言(OpenSource Language):Swift 90.9%开源软件介绍(OpenSource Introduction):LUAutocompleteViewEasy to use and highly configurable autocomplete view that is attachable to any InstallationCocoaPodsCocoaPods is a dependency manager for Cocoa projects. You can install it with the following command: $ sudo gem install cocoapods
To integrate source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'LUAutocompleteView'
end Then, run the following command: $ pod install CarthageYou can use Carthage to install
Then run If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained over at Carthage. Swift Package ManagerTo integrate using Apple's Swift Package Manager, add the following as a dependency to your .Package(url: "https://github.com/LaurentiuUngur/LUAutocompleteView", majorVersion: 4) Here's an example of import PackageDescription
let package = Package(name: "MyApp",
dependencies: [
.Package(url: "https://github.com/LaurentiuUngur/LUAutocompleteView", majorVersion: 4)
]) ManuallyIf you prefer not to use either of the before mentioned dependency managers, you can integrate Usage
import LUAutocompleteView
autocompleteView.textField = textField
autocompleteView.dataSource = self
autocompleteView.delegate = self
// 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()) }
completion(elementsThatMatchInput)
}
}
// MARK: - LUAutocompleteViewDelegate
extension ViewController: LUAutocompleteViewDelegate {
func autocompleteView(_ autocompleteView: LUAutocompleteView, didSelect text: String) {
print(text + " was selected from autocomplete view")
}
} Customisation
import UIKit
import LUAutocompleteView
final class CustomAutocompleteTableViewCell: LUAutocompleteTableViewCell {
// MARK: - Base Class Overrides
override func set(text: String) {
textLabel?.text = text
textLabel?.textColor = .red
}
}
autocompleteView.autocompleteCell = CustomAutocompleteTableViewCell.self For more usage details please see example appRequirements
AuthorLicense
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论