Skip to content

Commit

Permalink
Exposing URL in AppIconSet
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaal111 committed Dec 20, 2023
1 parent c0d5876 commit f9552b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/AppIconGenerator/AppIconGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ public enum AppIconGeneratorErrors: Error {
public struct AppIconSet: Codable, Hashable {
public let content: Contents
public let images: [AppIconSetImage]
public let url: URL?

public init(content: Contents, images: [AppIconSetImage]) {
public init(content: Contents, images: [AppIconSetImage], url: URL?) {
self.content = content
self.images = images
self.url = url
}

public struct AppIconSetImage: Codable, Hashable {
Expand Down Expand Up @@ -191,7 +193,7 @@ extension AppIconGenerator {
}
images.append(.init(filename: filename, data: pngData, url: url))
}
return .success(AppIconSet(content: contents, images: images))
return .success(AppIconSet(content: contents, images: images, url: appIconDirectory))
}
}

Expand Down
9 changes: 9 additions & 0 deletions Tests/AppIconGeneratorTests/AppIconGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ final class AppIconGeneratorTests: XCTestCase {
}

#if os(macOS)
func testAppIconSetURL() async throws {
let swiftUIImage = try getSwiftUIImage(named: "saitama", withExtension: "jpeg")
let outputDirectory = try makeOutputDirectory()

let appIconSet = try await AppIconGenerator.makeAppIconSet(to: outputDirectory, outOf: swiftUIImage).get()

XCTAssertEqual(appIconSet.url, outputDirectory.appending(path: "AppIcon.appiconset"))
}

func testAppIconSetContents() async throws {
let swiftUIImage = try getSwiftUIImage(named: "yami", withExtension: "jpg")
let outputDirectory = try makeOutputDirectory()
Expand Down

0 comments on commit f9552b3

Please sign in to comment.