Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirow committed May 12, 2019
1 parent bc18e31 commit 88a8acb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions Asset/ImageOrientation.swift
Expand Up @@ -4,21 +4,18 @@
// https://github.com/raphaelhanneken/iconizer
//

/// Possible image orientations for a launch image.
///
/// - Portrait: Portrait image.
/// - Landscape: Landscape image.
/// Possible image orientations
enum ImageOrientation: String {
case portrait
case landscape
case none
case all

//used to generate .json filename
var suffix: String {
switch self {
case .portrait: return "_Portrait"
case .landscape: return "_Landscape"
case .none: return ""
case .all: return ""
}
}
}
2 changes: 1 addition & 1 deletion Iconizer/Helper/Asset.swift
Expand Up @@ -25,7 +25,7 @@ extension Asset {
}

extension Asset where Self: Decodable {
static func images(forPlatform platform: Platform, orientation: ImageOrientation = .none) throws -> [Self] {
static func images(forPlatform platform: Platform, orientation: ImageOrientation = .all) throws -> [Self] {
//.json file
let url = try resourceURL(name: resourcePrefix + platform.name(forOrientation: orientation))
let data = try Data(contentsOf: url)
Expand Down
2 changes: 1 addition & 1 deletion Iconizer/Models/AppIcon.swift
Expand Up @@ -96,7 +96,7 @@ extension AppIcon: Asset {
}

func save(_ image: [ImageOrientation: NSImage], aspect: AspectMode?, to url: URL) throws {
guard let image = image[.none] else {
guard let image = image[.all] else {
throw AssetCatalogError.missingImage
}

Expand Down
2 changes: 1 addition & 1 deletion Iconizer/Models/AssetCatalog.swift
Expand Up @@ -15,7 +15,7 @@ class AssetCatalog<T: Codable & Asset>: Encodable {
private let author = "Iconizer"
private let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

func add(_ platform: Platform, orientation: ImageOrientation = .none) throws {
func add(_ platform: Platform, orientation: ImageOrientation = .all) throws {
let images = try T.images(forPlatform: platform, orientation: orientation)
items.append(contentsOf: images)
}
Expand Down
2 changes: 1 addition & 1 deletion Iconizer/Models/ImageSet.swift
Expand Up @@ -61,7 +61,7 @@ extension ImageSet: Asset {
}

func save(_ image: [ImageOrientation: NSImage], aspect: AspectMode?, to url: URL) throws {
guard let image = image[.none] else {
guard let image = image[.all] else {
throw AssetCatalogError.missingImage
}

Expand Down

0 comments on commit 88a8acb

Please sign in to comment.