Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit 8b28e03

Browse files
authored
feat(tweak): add option to always show search bar (#28)
Add a new tweak entry to control search bar visibility behavior. The search bar can now be configured to remain visible while scrolling through the tweak list.
1 parent c0e329e commit 8b28e03

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Sources/TPTweak/TPTweakEntry.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ extension TPTweakEntry {
166166
type: TPTweakEntryType.switch(defaultValue: false, completion: nil)
167167
)
168168
}
169+
170+
public static var _internal_tptweak_always_show_search_bar: TPTweakEntry {
171+
TPTweakEntry(
172+
category: "_tptweak",
173+
section: "Layout",
174+
cell: "Always Show Search Bar",
175+
footer: "",
176+
type: TPTweakEntryType.switch(defaultValue: false, completion: nil)
177+
)
178+
}
169179
}
170180

171181
// MARK: - indentifier helper

Sources/TPTweak/TPTweakViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public final class TPTweakViewController: UIViewController {
272272

273273
// setup search
274274
navigationItem.searchController = searchController
275-
navigationItem.hidesSearchBarWhenScrolling = true
275+
navigationItem.hidesSearchBarWhenScrolling = !(TPTweakEntry._internal_tptweak_always_show_search_bar.getValue(Bool.self) ?? false)
276276

277277
// register gesture
278278
navigationController?.navigationBar.isUserInteractionEnabled = true
@@ -332,7 +332,7 @@ public final class TPTweakViewController: UIViewController {
332332

333333
return value
334334
} else {
335-
return entry.cell
335+
return entry.section
336336
}
337337
}
338338

@@ -396,6 +396,7 @@ extension TPTweakViewController {
396396
let entries: [TPTweakEntry] = [
397397
._internal_tptweak_layout,
398398
._internal_tptweak_isMinimizable,
399+
._internal_tptweak_always_show_search_bar,
399400
._internal_tptweak_peepOpacity,
400401
.clearCache
401402
]

0 commit comments

Comments
 (0)