Skip to content

Commit

Permalink
- Removes RTF support
Browse files Browse the repository at this point in the history
- Fixes searchBar placeholder color
  • Loading branch information
glushchenko committed Dec 20, 2022
1 parent cd1a754 commit defa284
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FSNotes iOS/Settings/DefaultExtensionControllerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class DefaultExtensionViewController: UITableViewController {
NSLocalizedString("Files Naming", comment: "Settings"),
]

private var rowsInSection = [1, 4, 4]
private var rowsInSection = [1, 3, 4]

private var extensions = ["markdown", "md", "txt", "rtf"]
private var extensions = ["markdown", "md", "txt"]

private var naming = [
NSLocalizedString("Auto Rename By Title", comment: "Settings"),
Expand Down
14 changes: 14 additions & 0 deletions FSNotes iOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ class ViewController: UIViewController, UISearchBarDelegate, UIGestureRecognizer
searchController.searchBar.placeholder = NSLocalizedString("Search or create", comment: "")
searchController.searchBar.mixedBackgroundColor = Colors.Header
searchController.searchBar.mixedBarTintColor = MixedColor(normal: 0xffffff, night: 0xffffff)

if let textFieldInsideSearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField {
textFieldInsideSearchBar.attributedPlaceholder = NSAttributedString(string: textFieldInsideSearchBar.placeholder ?? "", attributes: [NSAttributedString.Key.foregroundColor : UIColor.gray])
}

searchController.searchBar.returnKeyType = .go
searchController.searchBar.showsCancelButton = true
searchController.searchBar.autocapitalizationType = .none
Expand Down Expand Up @@ -1532,3 +1537,12 @@ extension UIApplication {
self.endBackgroundTask(taskID)
}
}

extension UISearchBar {
func setPlaceholderTextColorTo(color: UIColor) {
let textFieldInsideSearchBar = self.value(forKey: "searchField") as? UITextField
textFieldInsideSearchBar?.textColor = color
let textFieldInsideSearchBarLabel = textFieldInsideSearchBar!.value(forKey: "placeholderLabel") as? UILabel
textFieldInsideSearchBarLabel?.textColor = color
}
}

0 comments on commit defa284

Please sign in to comment.