feat(RES-34): Fix plist font filename (#14)
All checks were successful
gitea-openium/resgen.swift/pipeline/head This commit looks good
All checks were successful
gitea-openium/resgen.swift/pipeline/head This commit looks good
Reviewed-on: #14
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedImage.swift
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created by Thibaut Schmitt on 24/01/2022.
|
||||
//
|
||||
@ -8,10 +8,14 @@
|
||||
import Foundation
|
||||
|
||||
enum ImageExtension: String {
|
||||
|
||||
case png
|
||||
}
|
||||
|
||||
struct ParsedImage {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
let name: String
|
||||
let tags: String
|
||||
let width: Int
|
||||
@ -33,34 +37,34 @@ struct ParsedImage {
|
||||
}
|
||||
|
||||
// MARK: - Convert
|
||||
|
||||
var convertArguments: (x1: ConvertArgument, x2: ConvertArgument, x3: ConvertArgument) {
|
||||
|
||||
var convertArguments: (x1: ConvertArgument, x2: ConvertArgument, x3: ConvertArgument) { // swiftlint:disable:this large_tuple
|
||||
var width1x = ""
|
||||
var height1x = ""
|
||||
var width2x = ""
|
||||
var height2x = ""
|
||||
var width3x = ""
|
||||
var height3x = ""
|
||||
|
||||
|
||||
if width != -1 {
|
||||
width1x = "\(width)"
|
||||
width2x = "\(width * 2)"
|
||||
width3x = "\(width * 3)"
|
||||
}
|
||||
|
||||
|
||||
if height != -1 {
|
||||
height1x = "\(height)"
|
||||
height2x = "\(height * 2)"
|
||||
height3x = "\(height * 3)"
|
||||
}
|
||||
|
||||
|
||||
return (x1: ConvertArgument(width: width1x, height: height1x),
|
||||
x2: ConvertArgument(width: width2x, height: height2x),
|
||||
x3: ConvertArgument(width: width3x, height: height3x))
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Assets
|
||||
|
||||
|
||||
func generateContentJson(isVector: Bool) -> String? {
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = .prettyPrinted
|
||||
@ -77,9 +81,8 @@ struct ParsedImage {
|
||||
}
|
||||
|
||||
func generateImageContent(isVector: Bool) -> AssetContent {
|
||||
|
||||
if !imageExtensions.contains(.png) && isVector {
|
||||
//Generate svg
|
||||
// Generate svg
|
||||
return AssetContent(
|
||||
images: [
|
||||
AssetImageDescription(
|
||||
@ -97,7 +100,7 @@ struct ParsedImage {
|
||||
)
|
||||
)
|
||||
} else {
|
||||
//Generate png
|
||||
// Generate png
|
||||
return AssetContent(
|
||||
images: [
|
||||
AssetImageDescription(
|
||||
@ -125,17 +128,17 @@ struct ParsedImage {
|
||||
}
|
||||
|
||||
// MARK: - Extension property
|
||||
|
||||
|
||||
func getImageProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||
if isSwiftUI {
|
||||
return """
|
||||
\(isStatic ? "static ": "")var \(name): Image {
|
||||
\(isStatic ? "static " : "")var \(name): Image {
|
||||
Image("\(name)")
|
||||
}
|
||||
"""
|
||||
}
|
||||
return """
|
||||
\(isStatic ? "static ": "")var \(name): UIImage {
|
||||
\(isStatic ? "static " : "")var \(name): UIImage {
|
||||
UIImage(named: "\(name)")!
|
||||
}
|
||||
"""
|
||||
|
Reference in New Issue
Block a user