-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔎 🔎 Implements a Search Bar for data filtering! 🔎 🔎
🔎 🔎 Implements a Search Bar for data filtering! 🔎 🔎 + Swift Data Tables will automatically add a search bar to the data grid. + The search will find occurrences in every single data item, efficiently. + A row will be returned in the filtering process if even one of it's data items contain the needle. + The default filtering algorithm uses a contains matching expression.
- Loading branch information
Showing
16 changed files
with
619 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// DataTableSearchTextField.swift | ||
// Pods | ||
// | ||
// Created by Pavan Kataria on 15/03/2017. | ||
// | ||
// | ||
|
||
import UIKit | ||
|
||
|
||
class DataTableSearchTextField: UITextField { | ||
|
||
//MARK: - Properties | ||
|
||
//MARK: - Lifecycle | ||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
self.setup() | ||
} | ||
|
||
public func setup(){ | ||
self.borderStyle = .none | ||
self.backgroundColor = UIColor.white | ||
self.clearButtonMode = .always | ||
} | ||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
self.layer.cornerRadius = (self.bounds.height / 2)-1 | ||
} | ||
|
||
let inset: CGFloat = 10 | ||
|
||
// placeholder position | ||
override func textRect(forBounds bounds: CGRect) -> CGRect { | ||
return bounds.insetBy(dx: inset , dy: inset) | ||
} | ||
|
||
// text position | ||
override func editingRect(forBounds bounds: CGRect) -> CGRect { | ||
return bounds.insetBy(dx: inset , dy: inset) | ||
} | ||
|
||
override func placeholderRect(forBounds bounds: CGRect) -> CGRect { | ||
return bounds.insetBy(dx: inset, dy: inset) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.