Skip to content

Commit d371051

Browse files
Fixed Auto-Search not working, by enabling the Search Button properly
1 parent 20bd2eb commit d371051

File tree

4 files changed

+104
-11
lines changed

4 files changed

+104
-11
lines changed

MetroTimer.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
345345
GCC_WARN_UNUSED_FUNCTION = YES;
346346
GCC_WARN_UNUSED_VARIABLE = YES;
347-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
347+
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
348348
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
349349
MTL_FAST_MATH = YES;
350350
ONLY_ACTIVE_ARCH = YES;
@@ -401,7 +401,7 @@
401401
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
402402
GCC_WARN_UNUSED_FUNCTION = YES;
403403
GCC_WARN_UNUSED_VARIABLE = YES;
404-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
404+
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
405405
MTL_ENABLE_DEBUG_INFO = NO;
406406
MTL_FAST_MATH = YES;
407407
SDKROOT = iphoneos;
@@ -425,11 +425,12 @@
425425
DEVELOPMENT_TEAM = 46C9Y785NA;
426426
ENABLE_PREVIEWS = YES;
427427
INFOPLIST_FILE = MetroTimer/Info.plist;
428+
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
428429
LD_RUNPATH_SEARCH_PATHS = (
429430
"$(inherited)",
430431
"@executable_path/Frameworks",
431432
);
432-
MARKETING_VERSION = 1.2.0;
433+
MARKETING_VERSION = 1.3.0;
433434
PRODUCT_BUNDLE_IDENTIFIER = de.JonasFrey.MetroTimer;
434435
PRODUCT_NAME = "$(TARGET_NAME)";
435436
SUPPORTS_MACCATALYST = YES;
@@ -451,11 +452,12 @@
451452
DEVELOPMENT_TEAM = 46C9Y785NA;
452453
ENABLE_PREVIEWS = YES;
453454
INFOPLIST_FILE = MetroTimer/Info.plist;
455+
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
454456
LD_RUNPATH_SEARCH_PATHS = (
455457
"$(inherited)",
456458
"@executable_path/Frameworks",
457459
);
458-
MARKETING_VERSION = 1.2.0;
460+
MARKETING_VERSION = 1.3.0;
459461
PRODUCT_BUNDLE_IDENTIFIER = de.JonasFrey.MetroTimer;
460462
PRODUCT_NAME = "$(TARGET_NAME)";
461463
SUPPORTS_MACCATALYST = YES;
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1100"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "AB38AF9C22AAEC2D00DC09BE"
18+
BuildableName = "MetroTimer.app"
19+
BlueprintName = "MetroTimer"
20+
ReferencedContainer = "container:MetroTimer.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "AB38AF9C22AAEC2D00DC09BE"
48+
BuildableName = "MetroTimer.app"
49+
BlueprintName = "MetroTimer"
50+
ReferencedContainer = "container:MetroTimer.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "AB38AF9C22AAEC2D00DC09BE"
65+
BuildableName = "MetroTimer.app"
66+
BlueprintName = "MetroTimer"
67+
ReferencedContainer = "container:MetroTimer.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

MetroTimer/Views/AddFavoriteView.swift

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,33 @@ struct AddFavoriteView : View {
1414

1515
@Environment(\.presentationMode) var presentationMode
1616
@State private var searchText: String = ""
17-
@State private var searchResults: [JFStation] = []
17+
@State private var searchResults: [JFStation]? = nil
1818

1919
var body: some View {
2020
NavigationView {
2121
VStack {
22-
SearchBar(text: $searchText, onSearchEditingChanged: {
22+
SearchBar(text: $searchText, onSearchButtonClicked: {
2323
guard !self.searchText.isEmpty else {
2424
return
2525
}
2626
print("Searching for \(self.searchText)")
2727
self.updateSearchResults()
2828
})
29-
List(searchResults) { station in
30-
NavigationLink(destination: AddLineView(station: station, superPresentationMode: self.presentationMode)) {
31-
Text(station.name)
32-
}.isDetailLink(false)
29+
// searchResults == nil means not yet searched!
30+
if searchResults != nil && searchResults!.isEmpty && !searchText.isEmpty {
31+
List {
32+
HStack {
33+
Spacer()
34+
Text("No results")
35+
Spacer()
36+
}
37+
}
38+
} else {
39+
List(searchResults ?? []) { station in
40+
NavigationLink(destination: AddLineView(station: station, superPresentationMode: self.presentationMode)) {
41+
Text(station.name)
42+
}.isDetailLink(false)
43+
}
3344
}
3445
}
3546
.navigationBarTitle("Station")
@@ -43,13 +54,14 @@ struct AddFavoriteView : View {
4354

4455
func updateSearchResults() {
4556
let request = Request()
57+
print("Searching for \(searchText)")
4658
request.searchStop(by: searchText) { (stops) in
4759
searchResults = stops.map { (stop) -> JFStation in
4860
let coordinates = JFCoordinates(lat: stop.coordinates.lat, lon: stop.coordinates.lon)
4961
return JFStation(id: stop.id, name: stop.name, coordinates: coordinates)
5062
}
5163
}
52-
print("Updated \(searchResults.count) search results")
64+
print("Updated \(searchResults?.count ?? -1) search results")
5365
}
5466
}
5567

de.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
"Please select a route and destination." = "Bitte wählen Sie eine Linie und eine Richtung";
2222
"Maximum rows to show for each station" = "Maximale Anzahl an Zeilen pro Station";
2323
"Settings" = "Einstellungen";
24+
"No results" = "Keine Ergebnisse";

0 commit comments

Comments
 (0)