From a54ab5a1d2e728feee1fc806e86bb1d4e05c3dff Mon Sep 17 00:00:00 2001 From: Alberto De Bortoli Date: Sat, 6 Apr 2019 01:29:33 +0100 Subject: [PATCH 1/4] Add support for filtering tweaks in TweaksConfigurationViewController --- Example/JustTweak.xcodeproj/project.pbxproj | 4 +- .../xcshareddata/WorkspaceSettings.xcsettings | 8 ++ Example/Podfile | 2 +- Example/Podfile.lock | 14 +-- JustTweak.podspec | 4 +- .../TweaksConfigurationViewController.swift | 87 +++++++++++++++++-- 6 files changed, 99 insertions(+), 20 deletions(-) create mode 100644 Example/JustTweak.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/Example/JustTweak.xcodeproj/project.pbxproj b/Example/JustTweak.xcodeproj/project.pbxproj index 2382399..64c0ea6 100644 --- a/Example/JustTweak.xcodeproj/project.pbxproj +++ b/Example/JustTweak.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -609,7 +609,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/Example/JustTweak.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Example/JustTweak.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..949b678 --- /dev/null +++ b/Example/JustTweak.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Original + + diff --git a/Example/Podfile b/Example/Podfile index 600a2c4..6cbacef 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,6 +1,6 @@ source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '9.0' +platform :ios, '11.0' use_frameworks! target 'JustTweak_Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index a33d100..5aca242 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -57,11 +57,11 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (5.3.6): - GoogleUtilities/Logger - - JustTweak (3.2.0): - - JustTweak/Core (= 3.2.0) - - JustTweak/UI (= 3.2.0) - - JustTweak/Core (3.2.0) - - JustTweak/UI (3.2.0): + - JustTweak (3.3.0): + - JustTweak/Core (= 3.3.0) + - JustTweak/UI (= 3.3.0) + - JustTweak/Core (3.3.0) + - JustTweak/UI (3.3.0): - JustTweak/Core - nanopb (0.3.901): - nanopb/decode (= 0.3.901) @@ -120,7 +120,7 @@ SPEC CHECKSUMS: FirebaseRemoteConfig: 7e11c65f0769c09bff6947997c209515058c5318 GoogleAppMeasurement: 98b71f5e04142793729a5ef23e5b96651ff4b70f GoogleUtilities: 95996bea7c7d9b8fb811b7507669a4a8762f80c7 - JustTweak: 2f6a9f5cf084cb7027f6a32b5f59751140fc52e8 + JustTweak: 78b51a3a9d6254315a14ba0e546116b1c6bbb337 nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 OptimizelySDKCore: cff8a662f868372ecedcd6be9ce823b546535a16 OptimizelySDKDatafileManager: 805457da07957741c9199ae4e15e671bf9f6edb0 @@ -130,6 +130,6 @@ SPEC CHECKSUMS: OptimizelySDKUserProfileService: 7cffcfbcdb104a864f7961b7a08e0a13de4540a4 Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 -PODFILE CHECKSUM: 699b095b8b7f3b37cd7fb3b4f31ba8cb862688e1 +PODFILE CHECKSUM: a7b727d37e751c9d933eb79a0171bbf9b553766d COCOAPODS: 1.5.3 diff --git a/JustTweak.podspec b/JustTweak.podspec index 9027e03..4d7b594 100644 --- a/JustTweak.podspec +++ b/JustTweak.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'JustTweak' - s.version = '3.2.0' + s.version = '3.3.0' s.summary = 'A framework for feature flagging, locally and remotely configure and A/B test iOS apps.' s.description = <<-DESC JustTweak is a framework for feature flagging, locally and remotely configure and A/B test iOS apps. @@ -12,7 +12,7 @@ JustTweak is a framework for feature flagging, locally and remotely configure an s.authors = { 'Just Eat iOS team' => 'justeat.ios.team@gmail.com', 'Gianluca Tranchedone' => 'gianluca.tranchedone@just-eat.com' } s.source = { :git => 'https://github.com/justeat/JustTweak.git', :tag => s.version.to_s } - s.ios.deployment_target = '9.0' + s.ios.deployment_target = '11.0' s.swift_version = '4.2' s.default_subspecs = 'Core', 'UI' diff --git a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift index 650236e..3ebc565 100644 --- a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift +++ b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift @@ -42,7 +42,8 @@ public class TweaksConfigurationViewController: UITableViewController { case Title, Items } - private var sections: [[String : Any]]? + private var sections = [[String : Any]]() + private var filteredSections = [[String : Any]]() public var configurationsCoordinator: TweaksConfigurationsCoordinator? { didSet { rebuildSections() @@ -63,6 +64,8 @@ public class TweaksConfigurationViewController: UITableViewController { comment: "") }() + private let searchController = UISearchController(searchResultsController: nil) + // MARK: Convenience Initializers public convenience init(style: UITableView.Style, configurationsCoordinator: TweaksConfigurationsCoordinator) { @@ -82,7 +85,8 @@ public class TweaksConfigurationViewController: UITableViewController { tableView.backgroundView = backgroundView tableView.keyboardDismissMode = .onDrag updateBackgroundView() - setUpBarButtonItems() + setupBarButtonItems() + setupSearchController() registerCellClasses() rebuildSections() } @@ -90,7 +94,10 @@ public class TweaksConfigurationViewController: UITableViewController { // MARK: UITableViewDataSource public override func numberOfSections(in tableView: UITableView) -> Int { - return sections?.count ?? 0 + if isFiltering() { + return filteredSections.count + } + return sections.count ?? 0 } public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { @@ -140,13 +147,25 @@ public class TweaksConfigurationViewController: UITableViewController { } private func titleForHeaderForSection(_ section: Int) -> String? { - let thisSection = sections?[section] - return thisSection?[SectionGroupKeys.Title.rawValue] as? String + let thisSection: [String: Any] = { + if isFiltering() { + return filteredSections[0] + } else { + return sections[section] + } + }() + return thisSection[SectionGroupKeys.Title.rawValue] as? String } private func tweaksIn(section: Int) -> [Tweak] { - let thisSection = sections?[section] - return thisSection?[SectionGroupKeys.Items.rawValue] as! [Tweak] + let thisSection: [String: Any] = { + if isFiltering() { + return filteredSections[0] + } else { + return sections[section] + } + }() + return thisSection[SectionGroupKeys.Items.rawValue] as! [Tweak] } fileprivate func tweakAt(indexPath: IndexPath) -> Tweak? { @@ -154,12 +173,20 @@ public class TweaksConfigurationViewController: UITableViewController { return tweaks[(indexPath as NSIndexPath).row] } - private func setUpBarButtonItems() { + private func setupBarButtonItems() { navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(dismissViewController)) } + private func setupSearchController() { + searchController.searchResultsUpdater = self + searchController.obscuresBackgroundDuringPresentation = false + searchController.searchBar.placeholder = "Search Tweaks" + navigationItem.searchController = searchController + definesPresentationContext = true + } + private func registerCellClasses() { tableView.register(BooleanTweakTableViewCell.self, forCellReuseIdentifier: CellIdentifiers.ToogleCell.rawValue) @@ -230,3 +257,47 @@ extension TweaksConfigurationViewController: TweaksConfigurationViewControllerCe } } } + +extension TweaksConfigurationViewController: UISearchResultsUpdating { + + public func updateSearchResults(for searchController: UISearchController) { + filterContentForSearchText(searchController.searchBar.text!) + } +} + +extension TweaksConfigurationViewController { + + func searchBarIsEmpty() -> Bool { + return searchController.searchBar.text?.isEmpty ?? true + } + + func filterContentForSearchText(_ searchText: String) { + var filteredTweaks = [Tweak]() + + for section in sections { + for (key, value) in section { + if key == SectionGroupKeys.Items.rawValue { + let tweaks = value as! [Tweak] + for tweak in tweaks { + if let title = tweak.title, title.lowercased().contains(searchText.lowercased()) { + filteredTweaks.append(tweak) + } + } + } + } + } + + filteredSections = [ + [ + SectionGroupKeys.Title.rawValue: "Filtered tweaks", + SectionGroupKeys.Items.rawValue: filteredTweaks + ] + ] + + tableView.reloadData() + } + + func isFiltering() -> Bool { + return searchController.isActive && !searchBarIsEmpty() + } +} From 50d41486216c2a9ff2651358c90aaa8daa12ecd1 Mon Sep 17 00:00:00 2001 From: Alberto De Bortoli Date: Sat, 6 Apr 2019 12:03:18 +0100 Subject: [PATCH 2/4] Simplify datasource data structure in TweaksConfigurationViewController --- .../TweaksConfigurationViewController.swift | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift index 3ebc565..64f6af5 100644 --- a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift +++ b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift @@ -18,6 +18,11 @@ internal protocol TweaksConfigurationViewControllerCellDelegate: class { public class TweaksConfigurationViewController: UITableViewController { + fileprivate struct Section { + let title: String + let tweaks: [Tweak] + } + fileprivate class Tweak { var feature: String var variable: String @@ -42,8 +47,8 @@ public class TweaksConfigurationViewController: UITableViewController { case Title, Items } - private var sections = [[String : Any]]() - private var filteredSections = [[String : Any]]() + private var sections = [Section]() + private var filteredSections = [Section]() public var configurationsCoordinator: TweaksConfigurationsCoordinator? { didSet { rebuildSections() @@ -147,25 +152,25 @@ public class TweaksConfigurationViewController: UITableViewController { } private func titleForHeaderForSection(_ section: Int) -> String? { - let thisSection: [String: Any] = { + let thisSection: Section = { if isFiltering() { return filteredSections[0] } else { return sections[section] } }() - return thisSection[SectionGroupKeys.Title.rawValue] as? String + return thisSection.title } private func tweaksIn(section: Int) -> [Tweak] { - let thisSection: [String: Any] = { + let thisSection: Section = { if isFiltering() { return filteredSections[0] } else { return sections[section] } }() - return thisSection[SectionGroupKeys.Items.rawValue] as! [Tweak] + return thisSection.tweaks } fileprivate func tweakAt(indexPath: IndexPath) -> Tweak? { @@ -197,7 +202,7 @@ public class TweaksConfigurationViewController: UITableViewController { } private func rebuildSections() { - var allSections = [[String : Any]]() + var allSections = [Section]() if let configurationsCoordinator = configurationsCoordinator { let allTweaks = configurationsCoordinator.displayableTweaks().sorted(by: { (lhs, rhs) -> Bool in return lhs.displayTitle < rhs.displayTitle @@ -220,14 +225,13 @@ public class TweaksConfigurationViewController: UITableViewController { } } if items.count > 0 { - let section: [String : Any] = [SectionGroupKeys.Items.rawValue: items, - SectionGroupKeys.Title.rawValue: group] + let section = Section(title: group, tweaks: items) allSections.append(section) } } } sections = allSections.sorted { (lhs, rhs) -> Bool in - return (lhs[SectionGroupKeys.Title.rawValue] as! String) < (rhs[SectionGroupKeys.Title.rawValue] as! String) + return lhs.title < rhs.title } tableView.reloadData() @@ -275,25 +279,14 @@ extension TweaksConfigurationViewController { var filteredTweaks = [Tweak]() for section in sections { - for (key, value) in section { - if key == SectionGroupKeys.Items.rawValue { - let tweaks = value as! [Tweak] - for tweak in tweaks { - if let title = tweak.title, title.lowercased().contains(searchText.lowercased()) { - filteredTweaks.append(tweak) - } - } + for tweak in section.tweaks { + if let title = tweak.title, title.lowercased().contains(searchText.lowercased()) { + filteredTweaks.append(tweak) } } } - filteredSections = [ - [ - SectionGroupKeys.Title.rawValue: "Filtered tweaks", - SectionGroupKeys.Items.rawValue: filteredTweaks - ] - ] - + filteredSections = [Section(title: "Filtered Tweaks", tweaks: filteredTweaks)] tableView.reloadData() } From 97176d4bf708b58fa0a79fd1f2644efb3dc3cbb5 Mon Sep 17 00:00:00 2001 From: Alberto De Bortoli Date: Sat, 6 Apr 2019 12:19:41 +0100 Subject: [PATCH 3/4] Keep sections when filtering tweaks --- .../TweaksConfigurationViewController.swift | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift index 64f6af5..aff2293 100644 --- a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift +++ b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift @@ -99,10 +99,7 @@ public class TweaksConfigurationViewController: UITableViewController { // MARK: UITableViewDataSource public override func numberOfSections(in tableView: UITableView) -> Int { - if isFiltering() { - return filteredSections.count - } - return sections.count ?? 0 + return isFiltering() ? filteredSections.count : sections.count } public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { @@ -152,24 +149,12 @@ public class TweaksConfigurationViewController: UITableViewController { } private func titleForHeaderForSection(_ section: Int) -> String? { - let thisSection: Section = { - if isFiltering() { - return filteredSections[0] - } else { - return sections[section] - } - }() + let thisSection: Section = isFiltering() ? filteredSections[section] : sections[section] return thisSection.title } private func tweaksIn(section: Int) -> [Tweak] { - let thisSection: Section = { - if isFiltering() { - return filteredSections[0] - } else { - return sections[section] - } - }() + let thisSection: Section = isFiltering() ? filteredSections[section] : sections[section] return thisSection.tweaks } @@ -276,17 +261,19 @@ extension TweaksConfigurationViewController { } func filterContentForSearchText(_ searchText: String) { - var filteredTweaks = [Tweak]() - + filteredSections = [Section]() for section in sections { + var filteredTweaks = [Tweak]() for tweak in section.tweaks { if let title = tweak.title, title.lowercased().contains(searchText.lowercased()) { filteredTweaks.append(tweak) } } + if filteredTweaks.count > 0 { + let filteredSection = Section(title: section.title, tweaks: filteredTweaks) + filteredSections.append(filteredSection) + } } - - filteredSections = [Section(title: "Filtered Tweaks", tweaks: filteredTweaks)] tableView.reloadData() } From 5a4ac9dfd05e9a1f7f57f06e3d34c4928bfd303f Mon Sep 17 00:00:00 2001 From: Alberto De Bortoli Date: Sat, 6 Apr 2019 12:34:19 +0100 Subject: [PATCH 4/4] Make the search functionality to work on iOS 10 --- Example/JustTweak.xcodeproj/project.pbxproj | 4 +-- Example/Podfile | 2 +- Example/Podfile.lock | 4 +-- JustTweak.podspec | 2 +- JustTweak/Assets/en.lproj/Localizable.strings | 1 + .../TweaksConfigurationViewController.swift | 33 +++++++++---------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Example/JustTweak.xcodeproj/project.pbxproj b/Example/JustTweak.xcodeproj/project.pbxproj index 64c0ea6..f90281e 100644 --- a/Example/JustTweak.xcodeproj/project.pbxproj +++ b/Example/JustTweak.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -609,7 +609,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/Example/Podfile b/Example/Podfile index 6cbacef..78f6d94 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,6 +1,6 @@ source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '11.0' +platform :ios, '10.0' use_frameworks! target 'JustTweak_Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 5aca242..bd435bd 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -120,7 +120,7 @@ SPEC CHECKSUMS: FirebaseRemoteConfig: 7e11c65f0769c09bff6947997c209515058c5318 GoogleAppMeasurement: 98b71f5e04142793729a5ef23e5b96651ff4b70f GoogleUtilities: 95996bea7c7d9b8fb811b7507669a4a8762f80c7 - JustTweak: 78b51a3a9d6254315a14ba0e546116b1c6bbb337 + JustTweak: c5ee966f54c0c00b14d6225c3f5714ad6a75a067 nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 OptimizelySDKCore: cff8a662f868372ecedcd6be9ce823b546535a16 OptimizelySDKDatafileManager: 805457da07957741c9199ae4e15e671bf9f6edb0 @@ -130,6 +130,6 @@ SPEC CHECKSUMS: OptimizelySDKUserProfileService: 7cffcfbcdb104a864f7961b7a08e0a13de4540a4 Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 -PODFILE CHECKSUM: a7b727d37e751c9d933eb79a0171bbf9b553766d +PODFILE CHECKSUM: bc8e9826fb88612e28170bb505bed61edc07bc72 COCOAPODS: 1.5.3 diff --git a/JustTweak.podspec b/JustTweak.podspec index 4d7b594..fce0d57 100644 --- a/JustTweak.podspec +++ b/JustTweak.podspec @@ -12,7 +12,7 @@ JustTweak is a framework for feature flagging, locally and remotely configure an s.authors = { 'Just Eat iOS team' => 'justeat.ios.team@gmail.com', 'Gianluca Tranchedone' => 'gianluca.tranchedone@just-eat.com' } s.source = { :git => 'https://github.com/justeat/JustTweak.git', :tag => s.version.to_s } - s.ios.deployment_target = '11.0' + s.ios.deployment_target = '10.0' s.swift_version = '4.2' s.default_subspecs = 'Core', 'UI' diff --git a/JustTweak/Assets/en.lproj/Localizable.strings b/JustTweak/Assets/en.lproj/Localizable.strings index 71b54df..98161b9 100644 --- a/JustTweak/Assets/en.lproj/Localizable.strings +++ b/JustTweak/Assets/en.lproj/Localizable.strings @@ -1,2 +1,3 @@ "just_tweak_unnamed_tweaks_group_title" = "Other"; "just_tweak_configurations_vc_no_configurations_message" = "No Mutable Configurations Found"; +"just_tweak_search_bar_placeholder_text" = "Search Tweaks"; diff --git a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift index aff2293..e16c825 100644 --- a/JustTweak/Classes/UI/TweaksConfigurationViewController.swift +++ b/JustTweak/Classes/UI/TweaksConfigurationViewController.swift @@ -43,10 +43,6 @@ public class TweaksConfigurationViewController: UITableViewController { case ToogleCell, TextCell, NumberCell } - private enum SectionGroupKeys: String { - case Title, Items - } - private var sections = [Section]() private var filteredSections = [Section]() public var configurationsCoordinator: TweaksConfigurationsCoordinator? { @@ -71,15 +67,11 @@ public class TweaksConfigurationViewController: UITableViewController { private let searchController = UISearchController(searchResultsController: nil) - // MARK: Convenience Initializers - public convenience init(style: UITableView.Style, configurationsCoordinator: TweaksConfigurationsCoordinator) { self.init(style: style) self.configurationsCoordinator = configurationsCoordinator } - // MARK: View Lifecycle - public override func viewDidLoad() { super.viewDidLoad() let backgroundView = TweaksErrorView() @@ -95,9 +87,10 @@ public class TweaksConfigurationViewController: UITableViewController { registerCellClasses() rebuildSections() } - - // MARK: UITableViewDataSource - +} + +extension TweaksConfigurationViewController { + public override func numberOfSections(in tableView: UITableView) -> Int { return isFiltering() ? filteredSections.count : sections.count } @@ -123,8 +116,6 @@ public class TweaksConfigurationViewController: UITableViewController { return titleForHeaderForSection(section) } - // MARK: Convenience - public func indexPathForTweak(with feature: String, variable: String) -> IndexPath? { for section in 0 ..< numberOfSections(in: tableView) { for (row, tweak) in tweaksIn(section: section).enumerated() { @@ -136,8 +127,6 @@ public class TweaksConfigurationViewController: UITableViewController { return nil } - // MARK: Helpers - private func cellIdentifierForTweak(_ tweak: Tweak) -> String { if let _ = tweak.value as? Bool { return CellIdentifiers.ToogleCell.rawValue @@ -162,6 +151,9 @@ public class TweaksConfigurationViewController: UITableViewController { let tweaks = tweaksIn(section: (indexPath as NSIndexPath).section) return tweaks[(indexPath as NSIndexPath).row] } +} + +extension TweaksConfigurationViewController { private func setupBarButtonItems() { navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, @@ -171,9 +163,16 @@ public class TweaksConfigurationViewController: UITableViewController { private func setupSearchController() { searchController.searchResultsUpdater = self + searchController.hidesNavigationBarDuringPresentation = false searchController.obscuresBackgroundDuringPresentation = false - searchController.searchBar.placeholder = "Search Tweaks" - navigationItem.searchController = searchController + searchController.searchBar.placeholder = NSLocalizedString("just_tweak_search_bar_placeholder_text", + bundle: TweaksConfigurationViewController.justTweakResourcesBundle(), + comment: "") + searchController.searchBar.sizeToFit() + + tableView.tableHeaderView = searchController.searchBar + // on iOS 11 it would be possible to add the searchController to the navigationItem instead of adding it as tableHeaderView + // navigationItem.searchController = searchController definesPresentationContext = true }