mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
added animations on search
remove all items cos its not needed :pf: added numericTextCompat
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924C3712EA9127200F20781 /* Emoji.swift */; };
|
||||
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = A935437A2EB2A3C800BB80A4 /* FilterCategory.swift */; };
|
||||
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
||||
A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
|
||||
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
|
||||
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
|
||||
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
|
||||
A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
|
||||
A9C172DE2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
|
||||
@@ -101,6 +104,7 @@
|
||||
A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; };
|
||||
A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StickerSlackTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerSlackTests.swift; sourceTree = "<group>"; };
|
||||
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = "<group>"; };
|
||||
A9C172DB2EB8C9AC008A7885 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = "<group>"; };
|
||||
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
|
||||
A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -193,6 +197,7 @@
|
||||
A949B1F92EA0517800215164 /* Emoji */,
|
||||
A9104C812EB4022E00D160EA /* Extensions */,
|
||||
A949B1EE2EA04E8200215164 /* Views */,
|
||||
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */,
|
||||
);
|
||||
path = StickerSlack;
|
||||
sourceTree = "<group>";
|
||||
@@ -396,6 +401,7 @@
|
||||
A924C3732EA9127200F20781 /* Emoji.swift in Sources */,
|
||||
A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */,
|
||||
A949B1F82EA04F2300215164 /* EmojiHoarder.swift in Sources */,
|
||||
A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
|
||||
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -407,6 +413,7 @@
|
||||
A986A6C32EB6598100B6E0FA /* FilterCategory.swift in Sources */,
|
||||
A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */,
|
||||
A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */,
|
||||
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
|
||||
A9C172DE2EB8C9AC008A7885 /* Trie.swift in Sources */,
|
||||
A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */,
|
||||
A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */,
|
||||
@@ -421,6 +428,7 @@
|
||||
A9104C7F2EB4022500D160EA /* MSSticker.swift in Sources */,
|
||||
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */,
|
||||
A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */,
|
||||
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
|
||||
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */,
|
||||
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */,
|
||||
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
||||
|
||||
@@ -16,7 +16,6 @@ class TrieNode: ObservableObject {
|
||||
|
||||
class Trie: ObservableObject {
|
||||
@Published var root: TrieNode = TrieNode()
|
||||
@Published var allItems: [String] = []
|
||||
|
||||
func insert(word: String) {
|
||||
let word = word.lowercased()
|
||||
@@ -35,7 +34,6 @@ class Trie: ObservableObject {
|
||||
currentNode.isEndOfWord = true
|
||||
}
|
||||
}
|
||||
self.allItems.append(word)
|
||||
}
|
||||
|
||||
func search(for query: String) -> Bool {
|
||||
@@ -52,7 +50,7 @@ class Trie: ObservableObject {
|
||||
}
|
||||
|
||||
func search(prefix prefixQuery: String) -> [String] {
|
||||
guard !prefixQuery.isEmpty else { return allItems }
|
||||
guard !prefixQuery.isEmpty else { return [] }
|
||||
let prefixQuery = prefixQuery.lowercased()
|
||||
var currentNode = root
|
||||
|
||||
@@ -127,19 +125,16 @@ struct TrieTestingView: View {
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.border(.orange)
|
||||
.onChange(of: filterTerm) { _ in
|
||||
filterResult = trie.search(prefix: filterTerm)
|
||||
withAnimation { filterResult = trie.search(prefix: filterTerm) }
|
||||
}
|
||||
Text("\(filterResult.count)")
|
||||
.modifier(numericTextCompat())
|
||||
|
||||
List(filterResult, id: \.self) { item in
|
||||
Text(item)
|
||||
}
|
||||
// .id(id)
|
||||
|
||||
Text("\(trie.root.children.count)")
|
||||
|
||||
// List {
|
||||
// TrieNodeView(trieNode: trie.root)
|
||||
// }
|
||||
// .id(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
StickerSlack/ViewModifiers.swift
Normal file
19
StickerSlack/ViewModifiers.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ViewModifiers.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 03/11/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct numericTextCompat: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
if #available(iOS 16, *) {
|
||||
content.contentTransition(.numericText())
|
||||
} else {
|
||||
content.transition(.opacity)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user