diff --git a/StickerSlack/Emoji/EmojiHoarder.swift b/StickerSlack/Emoji/EmojiHoarder.swift index 9b2acbd..f75da69 100644 --- a/StickerSlack/Emoji/EmojiHoarder.swift +++ b/StickerSlack/Emoji/EmojiHoarder.swift @@ -131,7 +131,8 @@ class EmojiHoarder: Hoarder, ObservableObject { func buildTrie() { let start = Date().timeIntervalSince1970 for emoji in emojis { -// trie.insewrt(word: emoji.name) +// trie.insert(word: emoji.name) + trie.wordlist.insert(emoji.name) trie.dict[emoji.name] = emoji } buildDownloadedEmojis() diff --git a/StickerSlack/SwiftUI/BrowseView.swift b/StickerSlack/SwiftUI/BrowseView.swift index 51d12ae..482561f 100644 --- a/StickerSlack/SwiftUI/BrowseView.swift +++ b/StickerSlack/SwiftUI/BrowseView.swift @@ -14,28 +14,33 @@ struct BrowseView: View { var body: some View { VStack { - Picker("", selection: $browseWhat) { - ForEach(StickerType.allCases) { type in - Text(type.description).tag(type) - } - } - .pickerStyle(.segmented) - switch browseWhat { - case .slackEmoji: - EmojiCollectionView( - hoarder: emojiHoarder, - items: emojiHoarder.emojis.map { $0.name } - ) - .ignoresSafeArea(.container, edges: .bottom) - .id(emojiHoarder.emojis) - case .giphyGifs: - ScrollView { - ForEach(gifHoarder.trendingGifs) { gif in - StickerRow(hoarder: emojiHoarder, sticker: gif) - .listRowSeparator(.hidden) + Group { + switch browseWhat { + case .slackEmoji: + EmojiCollectionView( + hoarder: emojiHoarder, + items: emojiHoarder.emojis.map { $0.name } + ) + .ignoresSafeArea(.container, edges: .bottom) + .id(emojiHoarder.emojis) + case .giphyGifs: + ScrollView { + ForEach(gifHoarder.trendingGifs) { gif in + StickerRow(hoarder: emojiHoarder, sticker: gif) + .listRowSeparator(.hidden) + } } } } + .overlay(alignment: .top) { + Picker("", selection: $browseWhat) { + ForEach(StickerType.allCases) { type in + Text(type.description).tag(type) + } + } + .pickerStyle(.segmented) + .padding(.horizontal) + } } } } diff --git a/StickerSlack/SwiftUI/DownloadedView.swift b/StickerSlack/SwiftUI/DownloadedView.swift index 91b45c0..c8686d2 100644 --- a/StickerSlack/SwiftUI/DownloadedView.swift +++ b/StickerSlack/SwiftUI/DownloadedView.swift @@ -42,7 +42,7 @@ struct DownloadedView: View { let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing))) let layout = Array(repeating: col, count: columns) LazyVGrid(columns: layout, spacing: spacing) { - ForEach(emojiHoarder.downloadedStickers.sorted(), id: \.self) { name in + ForEach(Array(emojiHoarder.downloadedStickers), id: \.self) { name in if let emoji = emojiHoarder.trie.dict[name] { ZStack { Rectangle()