diff --git a/Documentation/xtool.docc/Control.md b/Documentation/xtool.docc/Control.md index babd0c2e..7e7fbf28 100644 --- a/Documentation/xtool.docc/Control.md +++ b/Documentation/xtool.docc/Control.md @@ -108,6 +108,23 @@ iconPath: Resources/AppIcon.png > > Your app icon must be a png, and it should ideally have a resolution of 1024x1024px. +## Add an asset catalog + +To use an Xcode asset catalog (`.xcassets`), which can hold images, colors and the app icon, add it to `xtool.yml`: + +```yaml +assetCatalogs: +- Resources/Assets.xcassets +``` + +xtool compiles the catalog into `Assets.car` in the app bundle, so `Image("Logo", bundle: .main)` and `Color("Brand", bundle: .main)` work as usual. If the catalog contains an `AppIcon.appiconset`, xtool also adds the matching `CFBundleIcons` and `CFBundleIconName` keys to your `Info.plist`, and ignores `iconPath`. + +Extensions can have their own catalog via an `assetCatalogs` key on the extension entry. Each app or extension supports one catalog. + +> Note: +> +> xtool compiles catalogs itself, so it works on Linux. It supports PNG, JPEG and SVG images (SVG needs `rsvg-convert` installed), colors, and app icons with per-size entries. Single-size (1024x1024 "universal") app icons are supported, but their dark and tinted variants are ignored. PDF vectors, data sets, sticker packs and other specialized asset types are not supported. When you generate an Xcode project with `xtool dev generate-xcode-project`, the catalog is passed to Xcode unchanged. + ## Add entitlements You may need to add special [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements) to your app, for example you need the `com.apple.developer.homekit` entitlement in order to connect to HomeKit devices. diff --git a/Package.resolved b/Package.resolved index 4cc2f508..52aa06cc 100644 --- a/Package.resolved +++ b/Package.resolved @@ -10,6 +10,14 @@ "version" : "4.7.0" } }, + { + "identity" : "assetkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/TartanLeGrand/AssetKit", + "state" : { + "revision" : "90281d6dc0c4edef6176f9283283271198e4bafd" + } + }, { "identity" : "async-http-client", "kind" : "remoteSourceControl", @@ -37,6 +45,15 @@ "version" : "1.2.2" } }, + { + "identity" : "h", + "kind" : "remoteSourceControl", + "location" : "https://github.com/rarestype/h", + "state" : { + "revision" : "aa3626829160917d4378330617971977cbd78f5b", + "version" : "1.0.1" + } + }, { "identity" : "openapikit", "kind" : "remoteSourceControl", @@ -334,6 +351,15 @@ "version" : "1.3.1" } }, + { + "identity" : "swift-png", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tayloraswift/swift-png", + "state" : { + "revision" : "8a0bcd4df5e4b307c804937776a56dd6ecdf6396", + "version" : "4.5.1" + } + }, { "identity" : "swift-service-context", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 4a7766f7..d7d453ed 100644 --- a/Package.swift +++ b/Package.swift @@ -52,6 +52,9 @@ let package = Package( .package(url: "https://github.com/xtool-org/SwiftyMobileDevice", .upToNextMinor(from: "1.7.0")), .package(url: "https://github.com/xtool-org/zsign", .upToNextMinor(from: "1.9.0")), .package(url: "https://github.com/xtool-org/xadi", .upToNextMinor(from: "0.4.2")), + // TODO: temporary, points at the branch of xtool-org/AssetKit#2. Switch to + // .upToNextMinor(from: "") once AssetKit tags a release including it. + .package(url: "https://github.com/TartanLeGrand/AssetKit", revision: "90281d6dc0c4edef6176f9283283271198e4bafd"), .package(url: "https://github.com/apple/swift-system", from: "1.4.0"), .package(url: "https://github.com/apple/swift-http-types", from: "1.3.1"), @@ -167,6 +170,9 @@ let package = Package( "XToolSupport", "PackLib", ], + resources: [ + .copy("Fixtures"), + ], swiftSettings: swiftSettings, ), .target( @@ -195,6 +201,7 @@ let package = Package( dependencies: [ "XUtils", "XcodeProjects", + .product(name: "AssetKit", package: "AssetKit"), .product(name: "Superutils", package: "xtool-core"), .product(name: "Yams", package: "Yams"), .product(name: "XcodeProjectFormat", package: "xcode-project-format"), diff --git a/Sources/PackLib/PackSchema.swift b/Sources/PackLib/PackSchema.swift index 297c4241..6cddd96c 100644 --- a/Sources/PackLib/PackSchema.swift +++ b/Sources/PackLib/PackSchema.swift @@ -19,6 +19,7 @@ public struct PackSchemaBase: Codable, Sendable { public var iconPath: String? public var resources: [String]? + public var assetCatalogs: [String]? public var extensions: [Extension]? @@ -30,6 +31,7 @@ public struct PackSchemaBase: Codable, Sendable { public var bundleID: String? public var infoPath: String public var resources: [String]? + public var assetCatalogs: [String]? public var entitlementsPath: String? } } @@ -75,6 +77,11 @@ public struct PackSchema: Sendable { throw StringError("xtool.yml: iconPath should have a 'png' path extension. Got '\(ext)'.") } } + + let catalogLists = [base.assetCatalogs] + (base.extensions ?? []).map(\.assetCatalogs) + if catalogLists.contains(where: { ($0?.count ?? 0) > 1 }) { + throw StringError("xtool.yml: assetCatalogs supports at most one catalog per product.") + } } // swiftlint:disable:next force_try diff --git a/Sources/PackLib/Packer.swift b/Sources/PackLib/Packer.swift index bd2057b7..5f8d0a92 100644 --- a/Sources/PackLib/Packer.swift +++ b/Sources/PackLib/Packer.swift @@ -1,6 +1,7 @@ import Foundation import XUtils import Subprocess +import AssetKit public struct Packer: Sendable { public let buildSettings: BuildSettings @@ -100,7 +101,7 @@ public struct Packer: Sendable { try await withThrowingTaskGroup(of: Void.self) { group in for product in plan.allProducts { - try pack( + try await pack( product: product, binDir: binDir, outputURL: product.directory(inApp: outputURL), @@ -131,7 +132,7 @@ public struct Packer: Sendable { binDir: URL, outputURL: URL, _ group: inout ThrowingTaskGroup - ) throws { + ) async throws { @Sendable func packFileToRoot(srcName: String) async throws { let srcURL = URL(fileURLWithPath: srcName) let destURL = outputURL.appendingPathComponent(srcURL.lastPathComponent) @@ -152,6 +153,9 @@ public struct Packer: Sendable { // Ensure output directory is available try? FileManager.default.createDirectory(at: outputURL, withIntermediateDirectories: true) + let assets = try await Packer.compileAssets(for: product) + let iconPath = Packer.iconPath(for: product, assets: assets) + for command in product.resources { group.addTask { switch command { @@ -179,11 +183,17 @@ public struct Packer: Sendable { } } } - if let iconPath = product.iconPath { + if let iconPath { group.addTask { try await packFileToRoot(srcName: iconPath) } } + if let assets { + group.addTask { + try assets.write(into: outputURL) + try Task.checkCancellation() + } + } group.addTask { try await packFile(srcName: product.targetName, dstName: product.product) } @@ -196,7 +206,11 @@ public struct Packer: Sendable { info["CFBundleSupportedPlatforms"] = Packer.cfBundleSupportedPlatforms(for: buildSettings.triple) } - if let iconPath = product.iconPath { + if let assets { + info.merge(assets.infoPlistAdditions) { _, new in new } + } + + if let iconPath { let iconName = URL(fileURLWithPath: iconPath).deletingPathExtension().lastPathComponent info["CFBundleIconFile"] = iconName } @@ -211,6 +225,49 @@ public struct Packer: Sendable { } } + /// The output of compiling a product's asset catalog. + struct CompiledAssets: Sendable { + /// The contents of `Assets.car`. + var carData: Data + /// Copies of the app icon renditions to place next to `Assets.car`, which SpringBoard falls back to. + var looseFiles: [LooseFile] = [] + /// Keys such as `CFBundleIcons` to merge into the product's Info.plist. + var infoPlistAdditions: [String: any Sendable] = [:] + + var hasAppIcon: Bool { !infoPlistAdditions.isEmpty } + + /// Writes `Assets.car` and the loose icon files into a product's bundle directory. + func write(into directory: URL) throws { + try carData.write(to: directory.appendingPathComponent("Assets.car")) + for file in looseFiles { + try file.data.write(to: directory.appendingPathComponent(file.name)) + } + } + } + + /// The loose `iconPath` file to pack. The catalog's AppIcon takes precedence over it. + static func iconPath(for product: Plan.Product, assets: CompiledAssets?) -> String? { + guard let iconPath = product.iconPath, assets?.hasAppIcon == true else { return product.iconPath } + FileHandle.standardError.write(Data( + "warning: ignoring iconPath '\(iconPath)' because the asset catalog defines an AppIcon.\n".utf8 + )) + return nil + } + + /// Compiles the product's asset catalog, if any. + /// + /// `XcodePacker` does not use this: it hands the catalog to Xcode, where actool compiles it. + static func compileAssets(for product: Plan.Product) async throws -> CompiledAssets? { + guard let catalogPath = product.assetCatalogPath else { return nil } + let result = try await XCAssetCompiler(deploymentTarget: product.deploymentTarget) + .compile(catalog: URL(fileURLWithPath: catalogPath)) + return CompiledAssets( + carData: result.carData, + looseFiles: result.appIconBundle?.looseFiles ?? [], + infoPlistAdditions: result.appIconBundle?.infoPlistAdditions ?? [:] + ) + } + static func cfBundleSupportedPlatforms(for triple: String) -> [String] { let components = triple.split(separator: "-").map(String.init) guard let appleIndex = components.firstIndex(of: "apple"), diff --git a/Sources/PackLib/Planner.swift b/Sources/PackLib/Planner.swift index df2f0125..61b87862 100644 --- a/Sources/PackLib/Planner.swift +++ b/Sources/PackLib/Planner.swift @@ -85,6 +85,7 @@ public struct Planner: Sendable { idSpecifier: schema.idSpecifier, iconPath: schema.iconPath, rootResources: schema.resources, + assetCatalogPath: schema.assetCatalogs?.first, entitlementsPath: schema.entitlementsPath ) @@ -101,6 +102,7 @@ public struct Planner: Sendable { idSpecifier: ext.bundleID.flatMap(PackSchema.IDSpecifier.bundleID) ?? .orgID(app.bundleID), iconPath: nil, rootResources: ext.resources, + assetCatalogPath: ext.assetCatalogs?.first, entitlementsPath: ext.entitlementsPath ) } @@ -123,6 +125,7 @@ public struct Planner: Sendable { idSpecifier: PackSchema.IDSpecifier, iconPath: String?, rootResources: [String]?, + assetCatalogPath: String?, entitlementsPath: String? ) async throws -> Plan.Product { let library = try selectLibrary( @@ -214,7 +217,8 @@ public struct Planner: Sendable { infoPlist: infoPlist, resources: resources, iconPath: iconPath, - entitlementsPath: entitlementsPath + entitlementsPath: entitlementsPath, + assetCatalogPath: assetCatalogPath ) } @@ -319,6 +323,8 @@ public struct Plan: Sendable { public var resources: [Resource] public var iconPath: String? public var entitlementsPath: String? + /// Path to an `.xcassets` catalog, relative to the package root. + public var assetCatalogPath: String? public var targetName: String { "\(self.product)-\(self.type.targetSuffix)" diff --git a/Sources/PackLib/XcodePacker.swift b/Sources/PackLib/XcodePacker.swift index d679ea78..17da23e7 100644 --- a/Sources/PackLib/XcodePacker.swift +++ b/Sources/PackLib/XcodePacker.swift @@ -61,6 +61,10 @@ public struct XcodePacker { "$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks", ]) } + if let catalogPath = product.assetCatalogPath, + let iconName = Self.appIconName(inCatalogAt: URL(fileURLWithPath: catalogPath, relativeTo: root)) { + buildSettings["ASSETCATALOG_COMPILER_APPICON_NAME"] = .string(iconName) + } if let entitlementsPath = product.entitlementsPath { let path = (entitlementsPath as NSString).isAbsolutePath ? entitlementsPath @@ -97,12 +101,14 @@ public struct XcodePacker { buildFiles: [], ) let resources = try resourceReferences(for: product, at: root) + // the catalog is passed through untouched: actool compiles it as part of the Xcode build. + let catalog = try product.assetCatalogPath.map { try assetCatalogReference($0, for: product) } groups.append(.group(.init( objectID: nil, name: product.product, path: try .init(base: .group, path: product.product), includeInIndex: nil, - children: [.fileReference(source), .fileReference(info)] + resources, + children: [.fileReference(source), .fileReference(info)] + resources + (catalog.map { [$0] } ?? []), ))) let productFilename = "\(product.targetName).\(product.type == .application ? "app" : "appex")" @@ -141,6 +147,9 @@ public struct XcodePacker { ), ) var phases = [sourcePhase, frameworksPhase] + if catalog != nil { + phases.append(.resources(.init(objectID: nil, name: nil))) + } if !resources.isEmpty { phases.append(.copy(.init( objectID: nil, @@ -272,6 +281,32 @@ public struct XcodePacker { } } + private func assetCatalogReference(_ path: String, for product: Plan.Product) throws -> XCSchema.Reference { + let isAbsolute = (path as NSString).isAbsolutePath + let referencePath = isAbsolute ? path : ("../.." as NSString).appendingPathComponent(path) + return .fileReference(.init( + objectID: nil, + path: try .init(base: isAbsolute ? .absolute : .project, path: referencePath), + explicitFileType: .init(fileTypeID: "folder.assetcatalog"), + expectedSignature: nil, + textEncoding: nil, + lineEnding: nil, + includeInIndex: nil, + buildFiles: [.init( + objectID: nil, + buildPhase: .named(target: .init(targetName: product.targetName), kind: .resources, name: nil), + properties: buildFileProperties(), + )], + )) + } + + /// The basename of the `.appiconset` in the catalog, which Xcode needs as `ASSETCATALOG_COMPILER_APPICON_NAME`. + static func appIconName(inCatalogAt catalog: URL) -> String? { + let contents = (try? FileManager.default.contentsOfDirectory(atPath: catalog.path)) ?? [] + return contents.sorted().first { $0.hasSuffix(".appiconset") } + .map { ($0 as NSString).deletingPathExtension } + } + private func buildFileProperties(removeHeadersOnCopy: Bool = false) -> XCSchema.BuildFileProperties { XCSchema.BuildFileProperties( platformFilters: [], diff --git a/Tests/XToolTests/AssetCatalogTests.swift b/Tests/XToolTests/AssetCatalogTests.swift new file mode 100644 index 00000000..6ef5eb4b --- /dev/null +++ b/Tests/XToolTests/AssetCatalogTests.swift @@ -0,0 +1,141 @@ +import Foundation +import Testing +@testable import PackLib + +private let fixtures = Bundle.module.url(forResource: "Fixtures", withExtension: nil)! +private let fixtureCatalog = fixtures.appendingPathComponent("Test.xcassets") + +private func product( + type: Plan.ProductType = .application, + catalog: URL? = fixtureCatalog, + iconPath: String? = nil +) -> Plan.Product { + Plan.Product( + type: type, + product: "Demo", + deploymentTarget: "17.0", + bundleID: "com.example.Demo", + infoPlist: [:], + resources: [], + iconPath: iconPath, + entitlementsPath: nil, + assetCatalogPath: catalog?.path + ) +} + +@Test func compileAssetsProducesCarAndIconPlist() async throws { + let assets = try #require(try await Packer.compileAssets(for: product())) + + // Assets.car is a BOM store, and the facet names are stored in clear. + #expect(assets.carData.prefix(8) == Data("BOMStore".utf8)) + for name in ["AppIcon", "Logo", "Brand"] { + #expect(assets.carData.contains(Data(name.utf8)), "missing facet \(name)") + } + + #expect(assets.hasAppIcon) + #expect(assets.infoPlistAdditions["CFBundleIconName"] as? String == "AppIcon") + let icons = try #require(assets.infoPlistAdditions["CFBundleIcons"] as? [String: any Sendable]) + #expect(icons["CFBundleIconName"] as? String == "AppIcon") +} + +// Xcode 14+ defaults to a single 1024x1024 "universal" icon with no scale. +@Test func compileAssetsSingleSizeAppIcon() async throws { + let catalog = fixtures.appendingPathComponent("SingleSize.xcassets") + let assets = try #require(try await Packer.compileAssets(for: product(catalog: catalog))) + #expect(assets.hasAppIcon) + #expect(assets.infoPlistAdditions["CFBundleIconName"] as? String == "AppIcon") + #expect(assets.looseFiles.contains { $0.name == "AppIcon60x60@2x.png" }) +} + +@Test func catalogAppIconOverridesIconPath() async throws { + let withIcon = product(iconPath: "Icon.png") + let assets = try await Packer.compileAssets(for: withIcon) + #expect(Packer.iconPath(for: withIcon, assets: assets) == nil) + #expect(Packer.iconPath(for: withIcon, assets: nil) == "Icon.png") +} + +@Test func compiledAssetsAreWrittenIntoTheBundle() async throws { + let dir = FileManager.default.temporaryDirectory.appendingPathComponent("xtool-test-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: dir) } + + let assets = try #require(try await Packer.compileAssets(for: product())) + try assets.write(into: dir) + #expect(try Data(contentsOf: dir.appendingPathComponent("Assets.car")) == assets.carData) + #expect(!assets.looseFiles.isEmpty) + for file in assets.looseFiles { + #expect(FileManager.default.fileExists(atPath: dir.appendingPathComponent(file.name).path)) + } +} + +@Test func compileAssetsIsNilWithoutCatalog() async throws { + #expect(try await Packer.compileAssets(for: product(catalog: nil)) == nil) +} + +@Test func compileAssetsFailsOnMissingCatalog() async { + let missing = fixtureCatalog.deletingLastPathComponent().appendingPathComponent("Missing.xcassets") + await #expect(throws: (any Error).self) { + _ = try await Packer.compileAssets(for: product(catalog: missing)) + } +} + +@Test func compiledCatalogIsDeterministic() async throws { + let first = try #require(try await Packer.compileAssets(for: product())) + let second = try #require(try await Packer.compileAssets(for: product())) + #expect(first.carData == second.carData) +} + +@Test func schemaAcceptsAssetCatalogsOnAppAndExtensions() async throws { + let yaml = """ + version: 1 + orgID: com.example + assetCatalogs: [Assets.xcassets] + extensions: + - product: Widget + infoPath: Widget.plist + assetCatalogs: [Widget/Assets.xcassets] + """ + let file = FileManager.default.temporaryDirectory.appendingPathComponent("xtool-\(UUID().uuidString).yml") + try Data(yaml.utf8).write(to: file) + defer { try? FileManager.default.removeItem(at: file) } + let schema = try await PackSchema(url: file) + #expect(schema.assetCatalogs == ["Assets.xcassets"]) + #expect(schema.extensions?.first?.assetCatalogs == ["Widget/Assets.xcassets"]) +} + +@Test func schemaRejectsMultipleCatalogsPerProduct() throws { + let app = PackSchemaBase(version: .v1, orgID: "com.example", assetCatalogs: ["A.xcassets", "B.xcassets"]) + #expect(throws: (any Error).self) { try PackSchema(validating: app) } + + let ext = PackSchemaBase.Extension( + product: "Widget", + infoPath: "Widget.plist", + assetCatalogs: ["A.xcassets", "B.xcassets"] + ) + let withExt = PackSchemaBase(version: .v1, orgID: "com.example", extensions: [ext]) + #expect(throws: (any Error).self) { try PackSchema(validating: withExt) } +} + +@Test func xcodePackerFindsAppIconName() { + #expect(XcodePacker.appIconName(inCatalogAt: fixtureCatalog) == "AppIcon") + #expect(XcodePacker.appIconName(inCatalogAt: fixtureCatalog.appendingPathComponent("Logo.imageset")) == nil) +} + +@Test func xcodePackerPassesCatalogThroughUncompiled() async throws { + let root = FileManager.default.temporaryDirectory.appendingPathComponent("xtool-test-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: root) } + + let app = product(catalog: URL(fileURLWithPath: "Assets.xcassets")) + let plan = Plan(app: app, extensions: []) + let workspace = try await XcodePacker(plan: plan).createProject(at: root) + #expect(workspace.pathExtension == "xcworkspace") + + let pbxproj = try String( + contentsOf: root.appendingPathComponent("xtool/.xtool-tmp/Demo.xcodeproj/project.pbxproj"), + encoding: .utf8 + ) + #expect(pbxproj.contains("folder.assetcatalog")) + #expect(pbxproj.contains("Assets.xcassets")) + #expect(pbxproj.contains("PBXResourcesBuildPhase")) +} diff --git a/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/Contents.json b/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d90c80b6 --- /dev/null +++ b/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images": [ + { + "filename": "icon-1024.png", + "idiom": "universal", + "platform": "ios", + "size": "1024x1024" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/icon-1024.png b/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/icon-1024.png new file mode 100644 index 00000000..ee0850b7 Binary files /dev/null and b/Tests/XToolTests/Fixtures/SingleSize.xcassets/AppIcon.appiconset/icon-1024.png differ diff --git a/Tests/XToolTests/Fixtures/SingleSize.xcassets/Contents.json b/Tests/XToolTests/Fixtures/SingleSize.xcassets/Contents.json new file mode 100644 index 00000000..74d6a722 --- /dev/null +++ b/Tests/XToolTests/Fixtures/SingleSize.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/Contents.json b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..0a46733e --- /dev/null +++ b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,26 @@ +{ + "images": [ + { + "filename": "icon-60@2x.png", + "idiom": "iphone", + "scale": "2x", + "size": "60x60" + }, + { + "filename": "icon-60@3x.png", + "idiom": "iphone", + "scale": "3x", + "size": "60x60" + }, + { + "filename": "icon-1024.png", + "idiom": "ios-marketing", + "scale": "1x", + "size": "1024x1024" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-1024.png b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-1024.png new file mode 100644 index 00000000..ee0850b7 Binary files /dev/null and b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-1024.png differ diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@2x.png b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 00000000..f41f8368 Binary files /dev/null and b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@3x.png b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 00000000..c3676d5c Binary files /dev/null and b/Tests/XToolTests/Fixtures/Test.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/Brand.colorset/Contents.json b/Tests/XToolTests/Fixtures/Test.xcassets/Brand.colorset/Contents.json new file mode 100644 index 00000000..fd3f197d --- /dev/null +++ b/Tests/XToolTests/Fixtures/Test.xcassets/Brand.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors": [ + { + "color": { + "color-space": "srgb", + "components": { + "red": "0.012", + "green": "0.965", + "blue": "0.996", + "alpha": "1.000" + } + }, + "idiom": "universal" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/Contents.json b/Tests/XToolTests/Fixtures/Test.xcassets/Contents.json new file mode 100644 index 00000000..74d6a722 --- /dev/null +++ b/Tests/XToolTests/Fixtures/Test.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/Contents.json b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/Contents.json new file mode 100644 index 00000000..6e053973 --- /dev/null +++ b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images": [ + { + "filename": "logo.png", + "idiom": "universal", + "scale": "1x" + }, + { + "filename": "logo@2x.png", + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo.png b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo.png new file mode 100644 index 00000000..ff6f7b51 Binary files /dev/null and b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo.png differ diff --git a/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo@2x.png b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo@2x.png new file mode 100644 index 00000000..8c4860e3 Binary files /dev/null and b/Tests/XToolTests/Fixtures/Test.xcassets/Logo.imageset/logo@2x.png differ