95% faster local image url getting

added localImageURL() test
This commit is contained in:
neon443
2025-10-30 15:33:31 +00:00
parent 780e66ce0d
commit b738a06835
3 changed files with 11 additions and 4 deletions

View File

@@ -564,7 +564,7 @@
A949B1EB2EA04C0C00215164 /* Debug */ = { A949B1EB2EA04C0C00215164 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = StickerSlack;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = StickerSlack/StickerSlack.entitlements; CODE_SIGN_ENTITLEMENTS = StickerSlack/StickerSlack.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
@@ -609,7 +609,7 @@
A949B1EC2EA04C0C00215164 /* Release */ = { A949B1EC2EA04C0C00215164 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = StickerSlack;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = StickerSlack/StickerSlack.entitlements; CODE_SIGN_ENTITLEMENTS = StickerSlack/StickerSlack.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;

View File

@@ -19,7 +19,8 @@ struct Emoji: Codable, Identifiable, Hashable {
let urlString = remoteImageURL.absoluteString let urlString = remoteImageURL.absoluteString
let split = urlString.split(separator: ".") let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")" let fileExtension = ".\(split.last ?? "png")"
return EmojiHoarder.container.appendingPathComponent(id.uuidString+fileExtension, conformingTo: .image) // return EmojiHoarder.container.appendingPathComponent(id.uuidString+fileExtension, conformingTo: .image)
return URL(string: EmojiHoarder.container.absoluteString+id.uuidString+fileExtension)!
} }
var remoteImageURL: URL var remoteImageURL: URL

View File

@@ -10,11 +10,17 @@ import Testing
struct StickerSlackTests { struct StickerSlackTests {
var hoarder = EmojiHoarder() var hoarder = EmojiHoarder()
@Test func example() async throws { @Test func stickerConversion() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions. // Write your test here and use APIs like `#expect(...)` to check expected conditions.
for emoji in hoarder.emojis { for emoji in hoarder.emojis {
print(emoji.sticker) print(emoji.sticker)
} }
} }
@Test func localImageURL() async throws {
for emoji in hoarder.emojis {
print(emoji.localImageURL)
}
}
} }