From cb26c6949261cdf22b61f36290aaec93678ba292 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:17:41 +0100 Subject: [PATCH] added a little help fow when nothing matches search --- NearFuture.xcodeproj/project.pbxproj | 43 +------------------ .../xcshareddata/swiftpm/Package.resolved | 15 ------- NearFuture/Views/ContentView.swift | 3 -- NearFuture/Views/Home/HelpView.swift | 28 +++++++++++- .../Model/SymbolsPicker/SymbolsPicker.swift | 22 +++++++++- 5 files changed, 49 insertions(+), 62 deletions(-) delete mode 100644 NearFuture.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/NearFuture.xcodeproj/project.pbxproj b/NearFuture.xcodeproj/project.pbxproj index 43afb1f..aca3f6b 100644 --- a/NearFuture.xcodeproj/project.pbxproj +++ b/NearFuture.xcodeproj/project.pbxproj @@ -16,7 +16,6 @@ A90D49462DDE1C7A00781124 /* Tints.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A90D49432DDE1C1100781124 /* Tints.xcassets */; }; A90D49522DDE2D0000781124 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49512DDE2D0000781124 /* Extensions.swift */; }; A90D49532DDE2D0000781124 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49512DDE2D0000781124 /* Extensions.swift */; }; - A90D49562DDE2D5800781124 /* SFSymbolsPicker in Frameworks */ = {isa = PBXBuildFile; productRef = A90D49552DDE2D5800781124 /* SFSymbolsPicker */; }; A90D495B2DDE2EDB00781124 /* MacNearFutureApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495A2DDE2EDB00781124 /* MacNearFutureApp.swift */; }; A90D495E2DDE3C7400781124 /* NFCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495D2DDE3C7400781124 /* NFCommands.swift */; }; A90D495F2DDE3C7400781124 /* NFCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495D2DDE3C7400781124 /* NFCommands.swift */; }; @@ -46,7 +45,6 @@ A920C28C2D24011400E4F9B1 /* Events.swift in Sources */ = {isa = PBXBuildFile; fileRef = A920C28B2D24011400E4F9B1 /* Events.swift */; }; A920C28E2D24011A00E4F9B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A920C28D2D24011A00E4F9B1 /* Assets.xcassets */; }; A920C2922D24011A00E4F9B1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A920C2912D24011A00E4F9B1 /* Preview Assets.xcassets */; }; - A920C2BE2D24021A00E4F9B1 /* SFSymbolsPicker in Frameworks */ = {isa = PBXBuildFile; productRef = A920C2BD2D24021A00E4F9B1 /* SFSymbolsPicker */; }; A949F8322DCAAA8A0064DCA0 /* NearFutureIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = A949F8312DCAAA8A0064DCA0 /* NearFutureIcon.png */; }; A949F84B2DCAABE00064DCA0 /* ArchiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F83A2DCAABE00064DCA0 /* ArchiveView.swift */; }; A949F84C2DCAABE00064DCA0 /* AddEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F83C2DCAABE00064DCA0 /* AddEventView.swift */; }; @@ -66,6 +64,7 @@ A95E9EDA2DFC742B00ED655F /* AccentIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95E9ED72DFC742B00ED655F /* AccentIcon.swift */; }; A95E9EE42DFC77D400ED655F /* ImportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F8452DCAABE00064DCA0 /* ImportView.swift */; }; A95E9EE52DFC77E200ED655F /* ExportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F8432DCAABE00064DCA0 /* ExportView.swift */; }; + A96609E72DFD800000DBFA78 /* HelpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F8412DCAABE00064DCA0 /* HelpView.swift */; }; A979F60A2D270AF00094C0B3 /* NearFutureWidgetsBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = A979F6092D270AF00094C0B3 /* NearFutureWidgetsBundle.swift */; }; A979F60C2D270AF00094C0B3 /* NearFutureWidgetsLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = A979F60B2D270AF00094C0B3 /* NearFutureWidgetsLiveActivity.swift */; }; A979F6102D270AF90094C0B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A979F60F2D270AF80094C0B3 /* Assets.xcassets */; }; @@ -167,7 +166,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A90D49562DDE2D5800781124 /* SFSymbolsPicker in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -175,7 +173,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A920C2BE2D24021A00E4F9B1 /* SFSymbolsPicker in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -404,11 +401,9 @@ ); dependencies = ( A98C20D22DE732B10008D61C /* PBXTargetDependency */, - A90D494D2DDE2C6000781124 /* PBXTargetDependency */, ); name = MacNearFuture; packageProductDependencies = ( - A90D49552DDE2D5800781124 /* SFSymbolsPicker */, ); productName = MacNearFuture; productReference = A90D49262DDE0FA400781124 /* Near Future.app */; @@ -430,7 +425,6 @@ ); name = NearFuture; packageProductDependencies = ( - A920C2BD2D24021A00E4F9B1 /* SFSymbolsPicker */, ); productName = NearFuture; productReference = A920C2842D24011400E4F9B1 /* NearFuture.app */; @@ -484,7 +478,6 @@ ); mainGroup = A920C27B2D24011300E4F9B1; packageReferences = ( - A920C2BC2D24021900E4F9B1 /* XCRemoteSwiftPackageReference "SFSymbolsPicker" */, ); productRefGroup = A920C2852D24011400E4F9B1 /* Products */; projectDirPath = ""; @@ -557,6 +550,7 @@ A90D49382DDE0FAF00781124 /* ContentViewMac.swift in Sources */, A90D49622DDE626300781124 /* Settings.swift in Sources */, A95E9ED32DFC703200ED655F /* iCloudSettingsView.swift in Sources */, + A96609E72DFD800000DBFA78 /* HelpView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -612,10 +606,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - A90D494D2DDE2C6000781124 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - productRef = A90D494C2DDE2C6000781124 /* SFSymbolsPicker */; - }; A979F6132D270AF90094C0B3 /* PBXTargetDependency */ = { isa = PBXTargetDependency; platformFilter = ios; @@ -1044,35 +1034,6 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - A920C2BC2D24021900E4F9B1 /* XCRemoteSwiftPackageReference "SFSymbolsPicker" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/alessiorubicini/SFSymbolsPicker"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.0.6; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - A90D494C2DDE2C6000781124 /* SFSymbolsPicker */ = { - isa = XCSwiftPackageProductDependency; - package = A920C2BC2D24021900E4F9B1 /* XCRemoteSwiftPackageReference "SFSymbolsPicker" */; - productName = SFSymbolsPicker; - }; - A90D49552DDE2D5800781124 /* SFSymbolsPicker */ = { - isa = XCSwiftPackageProductDependency; - package = A920C2BC2D24021900E4F9B1 /* XCRemoteSwiftPackageReference "SFSymbolsPicker" */; - productName = SFSymbolsPicker; - }; - A920C2BD2D24021A00E4F9B1 /* SFSymbolsPicker */ = { - isa = XCSwiftPackageProductDependency; - package = A920C2BC2D24021900E4F9B1 /* XCRemoteSwiftPackageReference "SFSymbolsPicker" */; - productName = SFSymbolsPicker; - }; -/* End XCSwiftPackageProductDependency section */ }; rootObject = A920C27C2D24011300E4F9B1 /* Project object */; } diff --git a/NearFuture.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/NearFuture.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index b5805b7..0000000 --- a/NearFuture.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,15 +0,0 @@ -{ - "originHash" : "19df39f99b22f4ef95b73ed292ffb0c8d7694dd4c9db2b96ea73b091b7b1a026", - "pins" : [ - { - "identity" : "sfsymbolspicker", - "kind" : "remoteSourceControl", - "location" : "https://github.com/alessiorubicini/SFSymbolsPicker", - "state" : { - "revision" : "73c909b8a7fc77a30dd04208e33f759f8b52c4c8", - "version" : "1.0.6" - } - } - ], - "version" : 3 -} diff --git a/NearFuture/Views/ContentView.swift b/NearFuture/Views/ContentView.swift index 4c11370..c18e749 100644 --- a/NearFuture/Views/ContentView.swift +++ b/NearFuture/Views/ContentView.swift @@ -9,9 +9,6 @@ import SwiftUI import UserNotifications import SwiftData -enum Field { - case Search -} enum Tab { case home case archive diff --git a/NearFuture/Views/Home/HelpView.swift b/NearFuture/Views/Home/HelpView.swift index 24d4909..91346d1 100644 --- a/NearFuture/Views/Home/HelpView.swift +++ b/NearFuture/Views/Home/HelpView.swift @@ -11,6 +11,11 @@ import SwiftUI enum HelpType { case Search case Archive + case SymbolsSearch +} + +enum Field { + case Search } struct HelpView: View { @@ -31,6 +36,16 @@ struct HelpView: View { self.focusedField = nil } + /// initialises a symbolspciker helpview + /// - Parameters: + /// - searchInput: biding string + /// - searchFocused: a field + init(symbolsSearchInput: Binding, focusedField: Field?) { + _searchInput = symbolsSearchInput + self.helpType = .SymbolsSearch + _showAddEvent = .constant(false) + } + @Binding var searchInput: String @FocusState var focusedField: Field? @@ -69,12 +84,23 @@ struct HelpView: View { buttonSymbol: "plus", buttonText: "Create an event" ) + case .SymbolsSearch: + return ( + symbol: "magnifyingglass", + title: "You look lost", + body: "The symbol picker search only works with exact matches, try a different search term.", + buttonAction: { + searchInput = "" + }, + buttonSymbol: "xmark", + buttonText: "Clear Search bar" + ) } } var body: some View { List { ZStack { - Color(.tintColor) + Color(.accent) .opacity(0.4) .padding(.horizontal, -15) .blur(radius: 5) diff --git a/Shared/Model/SymbolsPicker/SymbolsPicker.swift b/Shared/Model/SymbolsPicker/SymbolsPicker.swift index 13fc3c2..4affa29 100644 --- a/Shared/Model/SymbolsPicker/SymbolsPicker.swift +++ b/Shared/Model/SymbolsPicker/SymbolsPicker.swift @@ -11,7 +11,13 @@ struct SymbolsPicker: View { @StateObject private var symbolsLoader = SymbolsLoader() @Binding var selection: String - @State var searchInput: String = "" + @FocusState var searchfocuesd: Bool + + @State var searchInput: String = "skldlkdsklsddkls" + + var symbols: [String] { + return symbolsLoader.getSymbols(searchInput) + } private func gridLayout(forWidth geoSizeWidth: CGFloat) -> [GridItem] { let gridItem = GridItem(.fixed(40), spacing: 20, alignment: .center) @@ -22,8 +28,20 @@ struct SymbolsPicker: View { var body: some View { GeometryReader { geo in ScrollView { + if symbols.isEmpty { + HStack { + Image(systemName: "magnifyingglass") + .resizable().scaledToFit() + .frame(width: 30) + Text("You look lost") + .font(.title) + .bold() + } + .padding() + Text("The symbol picker search only works with exact matches, try a different search term.") + } LazyVGrid(columns: gridLayout(forWidth: geo.size.width)) { - ForEach(symbolsLoader.getSymbols(searchInput), id: \.self) { symbol in + ForEach(symbols, id: \.self) { symbol in Button() { selection = symbol } label: {