diff --git a/StickerSlack.xcodeproj/project.pbxproj b/StickerSlack.xcodeproj/project.pbxproj index 6d786e6..04d70ed 100644 --- a/StickerSlack.xcodeproj/project.pbxproj +++ b/StickerSlack.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + A940FE3D2EA232590016870B /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* Emoji.swift */; }; A949B1F32EA04E8200215164 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A949B1EF2EA04E8200215164 /* Assets.xcassets */; }; A949B1F42EA04E8200215164 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F02EA04E8200215164 /* ContentView.swift */; }; A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F12EA04E8200215164 /* StickerSlackApp.swift */; }; @@ -16,6 +17,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + A940FE3C2EA232590016870B /* Emoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Emoji.swift; sourceTree = ""; }; A949B1DF2EA04C0B00215164 /* StickerSlack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StickerSlack.app; sourceTree = BUILT_PRODUCTS_DIR; }; A949B1EF2EA04E8200215164 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; A949B1F02EA04E8200215164 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -63,9 +65,9 @@ A949B1F22EA04E8200215164 /* StickerSlack */ = { isa = PBXGroup; children = ( - A949B1F92EA0517800215164 /* Emoji */, A949B1F12EA04E8200215164 /* StickerSlackApp.swift */, A949B1F72EA04F2300215164 /* EmojiHoarder.swift */, + A949B1F92EA0517800215164 /* Emoji */, A949B1EE2EA04E8200215164 /* Views */, A949B1F62EA04E8C00215164 /* Resources */, ); @@ -85,6 +87,7 @@ isa = PBXGroup; children = ( A949B1FA2EA0518800215164 /* SlackResponse.swift */, + A940FE3C2EA232590016870B /* Emoji.swift */, ); path = Emoji; sourceTree = ""; @@ -162,6 +165,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A940FE3D2EA232590016870B /* Emoji.swift in Sources */, A949B1F42EA04E8200215164 /* ContentView.swift in Sources */, A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */, A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */, diff --git a/StickerSlack/Emoji/Emoji.swift b/StickerSlack/Emoji/Emoji.swift new file mode 100644 index 0000000..75e90fd --- /dev/null +++ b/StickerSlack/Emoji/Emoji.swift @@ -0,0 +1,29 @@ +// +// Emoji.swift +// StickerSlack +// +// Created by neon443 on 17/10/2025. +// + +import Foundation +import SwiftUI + +struct Emoji: Codable, Hashable { + var name: String + var urlString: String + var url: URL { + return URL(string: urlString) ?? URL(string: "https://")! + } + var image: Image { + if let data = try? Data(contentsOf: url), + let uiimage = UIImage(data: data) { + return Image(uiImage: uiimage) + } + return Image(uiImage: UIImage()) + } + + init(name: String, url: String) { + self.name = name + self.urlString = url + } +} diff --git a/StickerSlack/Emoji/SlackResponse.swift b/StickerSlack/Emoji/SlackResponse.swift index 7d3414d..799a8d3 100644 --- a/StickerSlack/Emoji/SlackResponse.swift +++ b/StickerSlack/Emoji/SlackResponse.swift @@ -28,16 +28,3 @@ struct SlackResponse: Codable { } } } - -struct Emoji: Codable, Hashable { - var name: String - var urlString: String - var url: URL { - return URL(string: urlString) ?? URL(string: "https://")! - } - - init(name: String, url: String) { - self.name = name - self.urlString = url - } -} diff --git a/StickerSlack/Views/ContentView.swift b/StickerSlack/Views/ContentView.swift index 353521e..49e8800 100644 --- a/StickerSlack/Views/ContentView.swift +++ b/StickerSlack/Views/ContentView.swift @@ -16,7 +16,7 @@ struct ContentView: View { List { ForEach(hoarder.testBundle.toEmojis(), id: \.self) { emoji in Text(emoji.name) - AsyncImage(url: emoji.url) + emoji.image } } .tabItem {