Génération des extensions pour SwiftUI #2
21
SampleFiles/Colors/Generated/ColorYolo+GenAllScript.swift
Normal file
21
SampleFiles/Colors/Generated/ColorYolo+GenAllScript.swift
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Generated by ResgenSwift.Color 1.0
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension ColorYolo {
|
||||||
|
|
||||||
|
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
||||||
|
var red: Color {
|
||||||
|
Color("red")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
|
||||||
|
var green_alpha_50: Color {
|
||||||
|
Color("green_alpha_50")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
||||||
|
var blue_light_dark: Color {
|
||||||
|
Color("blue_light_dark")
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
// Generated from ColorToolCore at 2021-12-20 15:16:18 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIColor {
|
|
||||||
|
|
||||||
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
|
||||||
static var red: UIColor {
|
|
||||||
UIColor(named: "red")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
|
|
||||||
static var green_alpha_50: UIColor {
|
|
||||||
UIColor(named: "green_alpha_50")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
|
||||||
static var blue_light_dark: UIColor {
|
|
||||||
UIColor(named: "blue_light_dark")!
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Generated from ColorToolCore at 2022-02-14 09:30:19 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIColor {
|
|
||||||
|
|
||||||
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
|
||||||
static var red: UIColor {
|
|
||||||
UIColor(named: "red")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
|
|
||||||
static var green_alpha_50: UIColor {
|
|
||||||
UIColor(named: "green_alpha_50")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
|
||||||
static var blue_light_dark: UIColor {
|
|
||||||
UIColor(named: "blue_light_dark")!
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Generated from ColorToolCore at 2021-12-20 15:17:10 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIColor {
|
|
||||||
|
|
||||||
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
|
||||||
static var red: UIColor {
|
|
||||||
UIColor(named: "red")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
|
|
||||||
static var green_alpha_50: UIColor {
|
|
||||||
UIColor(named: "green_alpha_50")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
|
||||||
static var blue_light_dark: UIColor {
|
|
||||||
UIColor(named: "blue_light_dark")!
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Generated by ResgenSwift.ColorTool 1.0.0
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIColor {
|
|
||||||
|
|
||||||
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
|
||||||
static var red: UIColor {
|
|
||||||
UIColor(named: "red")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
|
|
||||||
static var green_alpha_50: UIColor {
|
|
||||||
UIColor(named: "green_alpha_50")!
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
|
||||||
static var blue_light_dark: UIColor {
|
|
||||||
UIColor(named: "blue_light_dark")!
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
// Generated from ColorToolCore at 2021-12-20 15:34:55 +0000
|
// Generated by ResgenSwift.Color 1.0
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension R2Color {
|
extension UIColorYolo {
|
||||||
|
|
||||||
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
/// Color red is #FF0000 (light) or #FF0000 (dark)"
|
||||||
@objc var red: UIColor {
|
@objc var red: UIColor {
|
||||||
@ -14,7 +14,7 @@ extension R2Color {
|
|||||||
UIColor(named: "green_alpha_50")!
|
UIColor(named: "green_alpha_50")!
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Color blue_light_dark is #0000FF (light) or #0000FF (dark)"
|
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
|
||||||
@objc var blue_light_dark: UIColor {
|
@objc var blue_light_dark: UIColor {
|
||||||
UIColor(named: "blue_light_dark")!
|
UIColor(named: "blue_light_dark")!
|
||||||
}
|
}
|
61
SampleFiles/Fonts/Generated/FontYolo+GenAllScript.swift
Normal file
61
SampleFiles/Fonts/Generated/FontYolo+GenAllScript.swift
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Generated by ResgenSwift.Fonts 1.0
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension FontYolo {
|
||||||
|
|
||||||
|
enum FontName: String {
|
||||||
|
case LatoItalic = "Lato-Italic"
|
||||||
|
case LatoLightItalic = "Lato-LightItalic"
|
||||||
|
case LatoHairline = "Lato-Hairline"
|
||||||
|
case LatoBold = "Lato-Bold"
|
||||||
|
case LatoBlack = "Lato-Black"
|
||||||
|
case LatoRegular = "Lato-Regular"
|
||||||
|
case LatoBlackItalic = "Lato-BlackItalic"
|
||||||
|
case LatoBoldItalic = "Lato-BoldItalic"
|
||||||
|
case LatoLight = "Lato-Light"
|
||||||
|
case LatoHairlineItalic = "Lato-HairlineItalic"
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Getter
|
||||||
|
|
||||||
|
func LatoItalic(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoItalic.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoLightItalic(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoLightItalic.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoHairline(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoHairline.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBold(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoBold.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBlack(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoBlack.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoRegular(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoRegular.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBlackItalic(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoBlackItalic.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBoldItalic(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoBoldItalic.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoLight(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoLight.rawValue, size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoHairlineItalic(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.LatoHairlineItalic.rawValue, size: size)
|
||||||
|
}
|
||||||
|
}
|
@ -1,62 +0,0 @@
|
|||||||
// Generated from FontToolCore
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension R2Font {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
func LatoItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoLightItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoHairline(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBold(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBlack(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoRegular(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBlackItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBoldItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoLight(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoHairlineItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
// Generated from FontToolCore
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension R2Font {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
func LatoItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoLightItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoHairline(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBold(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBlack(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoRegular(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBlackItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoBoldItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoLight(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
func LatoHairlineItalic(withSize size: CGFloat) -> UIFont {
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
// Lato/Lato-Italic.ttf Lato/Lato-LightItalic.ttf Lato/Lato-Thin.ttf Lato/Lato-Bold.ttf Lato/Lato-Black.ttf Lato/Lato-Regular.ttf Lato/Lato-BlackItalic.ttf Lato/Lato-BoldItalic.ttf Lato/Lato-Light.ttf Lato/Lato-ThinItalic.ttf
|
|
||||||
// Generated from FontToolCore
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIFont {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
static let LatoItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLightItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairline: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBold: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlack: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoRegular: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlackItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBoldItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLight: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairlineItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
// Generated from FontToolCore
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIFont {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
static let LatoItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLightItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairline: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBold: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlack: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoRegular: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlackItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBoldItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLight: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairlineItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
// Generated by ResgenSwift.FontTool 1.0.0
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIFont {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
static let LatoItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLightItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairline: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBold: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlack: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoRegular: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlackItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBoldItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLight: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairlineItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
}
|
|
61
SampleFiles/Fonts/Generated/UIFontYolo+GenAllScript.swift
Normal file
61
SampleFiles/Fonts/Generated/UIFontYolo+GenAllScript.swift
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Generated by ResgenSwift.Fonts 1.0
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
extension UIFontYolo {
|
||||||
|
|
||||||
|
enum FontName: String {
|
||||||
|
case LatoItalic = "Lato-Italic"
|
||||||
|
case LatoLightItalic = "Lato-LightItalic"
|
||||||
|
case LatoHairline = "Lato-Hairline"
|
||||||
|
case LatoBold = "Lato-Bold"
|
||||||
|
case LatoBlack = "Lato-Black"
|
||||||
|
case LatoRegular = "Lato-Regular"
|
||||||
|
case LatoBlackItalic = "Lato-BlackItalic"
|
||||||
|
case LatoBoldItalic = "Lato-BoldItalic"
|
||||||
|
case LatoLight = "Lato-Light"
|
||||||
|
case LatoHairlineItalic = "Lato-HairlineItalic"
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Getter
|
||||||
|
|
||||||
|
func LatoItalic(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoLightItalic(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoHairline(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBold(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBlack(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoRegular(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBlackItalic(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoBoldItalic(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoLight(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
|
||||||
|
func LatoHairlineItalic(withSize size: CGFloat) -> UIFont {
|
||||||
|
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
||||||
|
}
|
||||||
|
}
|
@ -1,62 +0,0 @@
|
|||||||
// Generated from FontToolCore
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIFont {
|
|
||||||
|
|
||||||
enum FontName: String {
|
|
||||||
case LatoItalic = "Lato-Italic"
|
|
||||||
case LatoLightItalic = "Lato-LightItalic"
|
|
||||||
case LatoHairline = "Lato-Hairline"
|
|
||||||
case LatoBold = "Lato-Bold"
|
|
||||||
case LatoBlack = "Lato-Black"
|
|
||||||
case LatoRegular = "Lato-Regular"
|
|
||||||
case LatoBlackItalic = "Lato-BlackItalic"
|
|
||||||
case LatoBoldItalic = "Lato-BoldItalic"
|
|
||||||
case LatoLight = "Lato-Light"
|
|
||||||
case LatoHairlineItalic = "Lato-HairlineItalic"
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Getter
|
|
||||||
|
|
||||||
static let LatoItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLightItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairline: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBold: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBold.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlack: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoRegular: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBlackItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoBoldItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoLight: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoLight.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
static let LatoHairlineItalic: ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
31
SampleFiles/Images/Generated/ImageYolo+GenAllScript.swift
Normal file
31
SampleFiles/Images/Generated/ImageYolo+GenAllScript.swift
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Generated by ResgenSwift.Images 1.0
|
||||||
|
// Images from sampleImages
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension ImageYolo {
|
||||||
|
|
||||||
|
var article_notification_pull_detail: Image {
|
||||||
|
Image("article_notification_pull_detail")
|
||||||
|
}
|
||||||
|
|
||||||
|
var article_notification_pull: Image {
|
||||||
|
Image("article_notification_pull")
|
||||||
|
}
|
||||||
|
|
||||||
|
var new_article: Image {
|
||||||
|
Image("new_article")
|
||||||
|
}
|
||||||
|
|
||||||
|
var welcome_background: Image {
|
||||||
|
Image("welcome_background")
|
||||||
|
}
|
||||||
|
|
||||||
|
var article_trash: Image {
|
||||||
|
Image("article_trash")
|
||||||
|
}
|
||||||
|
|
||||||
|
var ic_close_article: Image {
|
||||||
|
Image("ic_close_article")
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +1,31 @@
|
|||||||
// Generated by ResgenSwift.Imagium 1.0.0
|
// Generated by ResgenSwift.Images 1.0
|
||||||
// Images from sampleImages
|
// Images from sampleImages
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension UIImage {
|
extension UIImage {
|
||||||
|
|
||||||
static var article_notification_pull_detail: UIImage {
|
var article_notification_pull_detail: UIImage {
|
||||||
UIImage(named: "article_notification_pull_detail")!
|
UIImage(named: "article_notification_pull_detail")!
|
||||||
}
|
}
|
||||||
|
|
||||||
static var article_notification_pull: UIImage {
|
var article_notification_pull: UIImage {
|
||||||
UIImage(named: "article_notification_pull")!
|
UIImage(named: "article_notification_pull")!
|
||||||
}
|
}
|
||||||
|
|
||||||
static var new_article: UIImage {
|
var new_article: UIImage {
|
||||||
UIImage(named: "new_article")!
|
UIImage(named: "new_article")!
|
||||||
}
|
}
|
||||||
|
|
||||||
static var welcome_background: UIImage {
|
var welcome_background: UIImage {
|
||||||
UIImage(named: "welcome_background")!
|
UIImage(named: "welcome_background")!
|
||||||
}
|
}
|
||||||
|
|
||||||
static var article_trash: UIImage {
|
var article_trash: UIImage {
|
||||||
UIImage(named: "article_trash")!
|
UIImage(named: "article_trash")!
|
||||||
}
|
}
|
||||||
|
|
||||||
static var ic_close_article: UIImage {
|
var ic_close_article: UIImage {
|
||||||
UIImage(named: "ic_close_article")!
|
UIImage(named: "ic_close_article")!
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,32 +0,0 @@
|
|||||||
// Generated from Imagium at 2022-02-14 09:30:23 +0000
|
|
||||||
// Images from sampleImages
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIImage {
|
|
||||||
|
|
||||||
static var article_notification_pull_detail: UIImage {
|
|
||||||
UIImage(named: "article_notification_pull_detail")!
|
|
||||||
}
|
|
||||||
|
|
||||||
static var article_notification_pull: UIImage {
|
|
||||||
UIImage(named: "article_notification_pull")!
|
|
||||||
}
|
|
||||||
|
|
||||||
static var new_article: UIImage {
|
|
||||||
UIImage(named: "new_article")!
|
|
||||||
}
|
|
||||||
|
|
||||||
static var welcome_background: UIImage {
|
|
||||||
UIImage(named: "welcome_background")!
|
|
||||||
}
|
|
||||||
|
|
||||||
static var article_trash: UIImage {
|
|
||||||
UIImage(named: "article_trash")!
|
|
||||||
}
|
|
||||||
|
|
||||||
static var ic_close_article: UIImage {
|
|
||||||
UIImage(named: "ic_close_article")!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
// Generated from StringToolCore at 2022-01-10 08:27:11 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
fileprivate let kStringsFileName = "sampleStrings"
|
|
||||||
|
|
||||||
extension MyString {
|
|
||||||
|
|
||||||
// MARK: - Webservice
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// en
|
|
||||||
var param_lang: String {
|
|
||||||
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Generic
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Back
|
|
||||||
var generic_back: String {
|
|
||||||
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Loading data...
|
|
||||||
var generic_loading_data: String {
|
|
||||||
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome %@ !
|
|
||||||
var generic_welcome_firstname_format: String {
|
|
||||||
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome %@ !", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// Generated by ResgenSwift.Strings.Stringium 1.0.0
|
// Generated by ResgenSwift.Strings.Stringium 1.0
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@ -6,60 +6,59 @@ fileprivate let kStringsFileName = "sampleStrings"
|
|||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
|
|
||||||
// MARK: - Webservice
|
// MARK: - Webservice
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// en
|
/// en
|
||||||
static var param_lang: String {
|
var param_lang: String {
|
||||||
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Generic
|
// MARK: - Generic
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// Back
|
/// Back
|
||||||
static var generic_back: String {
|
var generic_back: String {
|
||||||
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// Loading data...
|
/// Loading data...
|
||||||
static var generic_loading_data: String {
|
var generic_loading_data: String {
|
||||||
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// Welcome \"%@\" !
|
/// Welcome \"%@\" !
|
||||||
static var generic_welcome_firstname_format: String {
|
var generic_welcome_firstname_format: String {
|
||||||
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
|
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// Welcome \"%@\" !
|
/// Welcome \"%@\" !
|
||||||
static func generic_welcome_firstname_format(arg0: String) -> String {
|
func generic_welcome_firstname_format(arg0: String) -> String {
|
||||||
String(format: Self.generic_welcome_firstname_format, arg0)
|
String(format: self.generic_welcome_firstname_format, arg0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - EqualSymbol
|
// MARK: - EqualSymbol
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// 1€ = 1 point !
|
/// 1€ = 1 point !
|
||||||
static var test_equal_symbol: String {
|
var test_equal_symbol: String {
|
||||||
NSLocalizedString("test_equal_symbol", tableName: kStringsFileName, bundle: Bundle.main, value: "1€ = 1 point !", comment: "")
|
NSLocalizedString("test_equal_symbol", tableName: kStringsFileName, bundle: Bundle.main, value: "1€ = 1 point !", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Placeholders
|
// MARK: - Placeholders
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
/// You %%: %2$@ %1$@ Age: %3$d
|
||||||
static var placeholders_test_one: String {
|
var placeholders_test_one: String {
|
||||||
NSLocalizedString("placeholders_test_one", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "")
|
NSLocalizedString("placeholders_test_one", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in en :
|
/// Translation in en :
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
/// You %%: %2$@ %1$@ Age: %3$d
|
||||||
static func placeholders_test_one(arg0: String, arg1: String, arg2: Int) -> String {
|
func placeholders_test_one(arg0: String, arg1: String, arg2: Int) -> String {
|
||||||
String(format: Self.placeholders_test_one, arg0, arg1, arg2)
|
String(format: self.placeholders_test_one, arg0, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,57 +0,0 @@
|
|||||||
// Generated from Strings-Stringium at 2022-03-07 11:02:15 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
fileprivate let kStringsFileName = "sampleStrings"
|
|
||||||
|
|
||||||
extension String {
|
|
||||||
|
|
||||||
// MARK: - Webservice
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// en
|
|
||||||
static var param_lang: String {
|
|
||||||
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Generic
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Back
|
|
||||||
static var generic_back: String {
|
|
||||||
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Loading data...
|
|
||||||
static var generic_loading_data: String {
|
|
||||||
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome \"%@\" !
|
|
||||||
static var generic_welcome_firstname_format: String {
|
|
||||||
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome \"%@\" !
|
|
||||||
static func generic_welcome_firstname_format(arg0: String) -> String {
|
|
||||||
String(format: Self.generic_welcome_firstname_format, arg0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Placeholders
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
|
||||||
static var placeholders_test_one: String {
|
|
||||||
NSLocalizedString("placeholders_test_one", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
|
||||||
static func placeholders_test_one(arg0: String, arg1: String, arg2: Int) -> String {
|
|
||||||
String(format: Self.placeholders_test_one, arg0, arg1, arg2)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
// Generated from StringToolCore at 2022-01-10 08:39:52 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
fileprivate let kStringsFileName = "sampleStrings"
|
|
||||||
|
|
||||||
extension String {
|
|
||||||
|
|
||||||
// MARK: - Webservice
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// en
|
|
||||||
static var param_lang: String {
|
|
||||||
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Generic
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Back
|
|
||||||
static var generic_back: String {
|
|
||||||
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Loading data...
|
|
||||||
static var generic_loading_data: String {
|
|
||||||
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome \"%@\" !
|
|
||||||
static var generic_welcome_firstname_format: String {
|
|
||||||
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
// Generated from Strings-Stringium at 2022-03-07 11:00:52 +0000
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
fileprivate let kStringsFileName = "sampleStrings"
|
|
||||||
|
|
||||||
extension StringTest {
|
|
||||||
|
|
||||||
// MARK: - Webservice
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// en
|
|
||||||
var param_lang: String {
|
|
||||||
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Generic
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Back
|
|
||||||
var generic_back: String {
|
|
||||||
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Loading data...
|
|
||||||
var generic_loading_data: String {
|
|
||||||
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome \"%@\" !
|
|
||||||
var generic_welcome_firstname_format: String {
|
|
||||||
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// Welcome \"%@\" !
|
|
||||||
func generic_welcome_firstname_format(arg0: String) -> String {
|
|
||||||
String(format: self.generic_welcome_firstname_format, arg0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Placeholders
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
|
||||||
var placeholders_test_one: String {
|
|
||||||
NSLocalizedString("placeholders_test_one", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in en :
|
|
||||||
/// You %%: %2$@ %1$@ Age: %3$d
|
|
||||||
func placeholders_test_one(arg0: String, arg1: String, arg2: Int) -> String {
|
|
||||||
String(format: self.placeholders_test_one, arg0, arg1, arg2)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Apple Strings File
|
* Apple Strings File
|
||||||
* Generated by ResgenSwift 1.0.0
|
* Generated by ResgenSwift 1.0
|
||||||
* Language: en-us
|
* Language: en-us
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Apple Strings File
|
* Apple Strings File
|
||||||
* Generated by ResgenSwift 1.0.0
|
* Generated by ResgenSwift 1.0
|
||||||
* Language: en
|
* Language: en
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Apple Strings File
|
* Apple Strings File
|
||||||
* Generated by ResgenSwift 1.0.0
|
* Generated by ResgenSwift 1.0
|
||||||
* Language: fr
|
* Language: fr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
// Generated by ResgenSwift.Strings.Tags 1.0.0
|
// Generated by ResgenSwift.Strings.Tags 1.0
|
||||||
|
|
||||||
// typelias Tags = String
|
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension Tags {
|
extension Tags {
|
||||||
|
|
||||||
// MARK: - ScreenTag
|
// MARK: - ScreenTag
|
||||||
|
|
||||||
/// Translation in ium :
|
/// Translation in ium :
|
||||||
/// Ecran un
|
/// Ecran un
|
||||||
static var screen_one: String {
|
var screen_one: String {
|
||||||
"Ecran un"
|
"Ecran un"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in ium :
|
/// Translation in ium :
|
||||||
/// Ecran deux
|
/// Ecran deux
|
||||||
static var screen_two: String {
|
var screen_two: String {
|
||||||
"Ecran deux"
|
"Ecran deux"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,23 +0,0 @@
|
|||||||
// Generated from Strings-Tags at 2022-02-14 09:30:20 +0000
|
|
||||||
|
|
||||||
// typelias Tags = String
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension Tags {
|
|
||||||
|
|
||||||
// MARK: - ScreenTag
|
|
||||||
|
|
||||||
/// Translation in ium :
|
|
||||||
/// Ecran un
|
|
||||||
static var screen_one: String {
|
|
||||||
"Ecran un"
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Translation in ium :
|
|
||||||
/// Ecran deux
|
|
||||||
static var screen_two: String {
|
|
||||||
"Ecran deux"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -2,26 +2,29 @@
|
|||||||
|
|
||||||
FORCE_FLAG="$1"
|
FORCE_FLAG="$1"
|
||||||
|
|
||||||
# Font
|
## Font
|
||||||
swift run -c release FontTool $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
||||||
--extension-output-path "./Fonts/Generated" \
|
--extension-output-path "./Fonts/Generated" \
|
||||||
--extension-name "UIFont" \
|
--extension-name "UIFontYolo" \
|
||||||
--extension-suffix "GenAllScript"
|
--extension-name-swift-ui "FontYolo" \
|
||||||
|
--extension-suffix "GenAllScript" \
|
||||||
|
#--infoPlistPaths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
||||||
|
|
||||||
echo "\n-------------------------\n"
|
echo "\n-------------------------\n"
|
||||||
|
|
||||||
# Color
|
# Color
|
||||||
swift run -c release ColorTool $FORCE_FLAG "./Colors/sampleColors1.txt" \
|
swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/sampleColors1.txt" \
|
||||||
--style all \
|
--style all \
|
||||||
--xcassets-path "./Colors/colors.xcassets" \
|
--xcassets-path "./Colors/colors.xcassets" \
|
||||||
--extension-output-path "./Colors/Generated/" \
|
--extension-output-path "./Colors/Generated/" \
|
||||||
--extension-name "UIColor" \
|
--extension-name "UIColorYolo" \
|
||||||
|
--extension-name-swift-ui "ColorYolo" \
|
||||||
--extension-suffix "GenAllScript"
|
--extension-suffix "GenAllScript"
|
||||||
|
|
||||||
echo "\n-------------------------\n"
|
echo "\n-------------------------\n"
|
||||||
|
|
||||||
# Twine
|
# Twine
|
||||||
swift run -c release Strings twine $FORCE_FLAG "./Twine/sampleStrings.txt" \
|
swift run -c release ResgenSwift strings twine $FORCE_FLAG "./Twine/sampleStrings.txt" \
|
||||||
--output-path "./Twine/Generated" \
|
--output-path "./Twine/Generated" \
|
||||||
--langs "fr en en-us" \
|
--langs "fr en en-us" \
|
||||||
--default-lang "en" \
|
--default-lang "en" \
|
||||||
@ -30,7 +33,7 @@ swift run -c release Strings twine $FORCE_FLAG "./Twine/sampleStrings.txt" \
|
|||||||
echo "\n-------------------------\n"
|
echo "\n-------------------------\n"
|
||||||
|
|
||||||
# Strings
|
# Strings
|
||||||
swift run -c release Strings stringium $FORCE_FLAG "./Strings/sampleStrings.txt" \
|
swift run -c release ResgenSwift strings stringium $FORCE_FLAG "./Strings/sampleStrings.txt" \
|
||||||
--output-path "./Strings/Generated" \
|
--output-path "./Strings/Generated" \
|
||||||
--langs "fr en en-us" \
|
--langs "fr en en-us" \
|
||||||
--default-lang "en" \
|
--default-lang "en" \
|
||||||
@ -41,7 +44,7 @@ swift run -c release Strings stringium $FORCE_FLAG "./Strings/sampleStrings.txt"
|
|||||||
echo "\n-------------------------\n"
|
echo "\n-------------------------\n"
|
||||||
|
|
||||||
# Tags
|
# Tags
|
||||||
swift run -c release Strings tags $FORCE_FLAG "./Tags/sampleTags.txt" \
|
swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/sampleTags.txt" \
|
||||||
--lang "ium" \
|
--lang "ium" \
|
||||||
--extension-output-path "./Tags/Generated" \
|
--extension-output-path "./Tags/Generated" \
|
||||||
--extension-name "Tags" \
|
--extension-name "Tags" \
|
||||||
@ -50,8 +53,9 @@ swift run -c release Strings tags $FORCE_FLAG "./Tags/sampleTags.txt" \
|
|||||||
echo "\n-------------------------\n"
|
echo "\n-------------------------\n"
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
swift run -c release Imagium $FORCE_FLAG "./Images/sampleImages.txt" \
|
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
||||||
--xcassets-path "./Images/imagium.xcassets" \
|
--xcassets-path "./Images/imagium.xcassets" \
|
||||||
--extension-output-path "./Images/Generated" \
|
--extension-output-path "./Images/Generated" \
|
||||||
--extension-name "UIImage" \
|
--extension-name "UIImage" \
|
||||||
|
--extension-name-swift-ui "ImageYolo" \
|
||||||
--extension-suffix "GenAllScript"
|
--extension-suffix "GenAllScript"
|
||||||
|
@ -22,6 +22,7 @@ struct Colors: ParsableCommand {
|
|||||||
|
|
||||||
static let toolName = "Color"
|
static let toolName = "Color"
|
||||||
static let defaultExtensionName = "UIColor"
|
static let defaultExtensionName = "UIColor"
|
||||||
|
static let defaultExtensionNameSUI = "Color"
|
||||||
static let assetsColorsFolderName = "Colors"
|
static let assetsColorsFolderName = "Colors"
|
||||||
|
|
||||||
// MARK: - Command options
|
// MARK: - Command options
|
||||||
@ -55,9 +56,16 @@ struct Colors: ParsableCommand {
|
|||||||
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
extensionName: options.extensionName,
|
extensionName: options.extensionName,
|
||||||
extensionFilePath: options.extensionFilePath)
|
extensionFilePath: options.extensionFilePath,
|
||||||
// -> Time: 0.0010340213775634766 seconds
|
isSwiftUI: false)
|
||||||
|
|
||||||
|
// Generate extension
|
||||||
|
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
||||||
|
staticVar: options.staticMembers,
|
||||||
|
extensionName: options.extensionNameSwiftUI,
|
||||||
|
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||||
|
isSwiftUI: true)
|
||||||
|
|
||||||
print("[\(Self.toolName)] Colors generated")
|
print("[\(Self.toolName)] Colors generated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +88,13 @@ struct Colors: ParsableCommand {
|
|||||||
Colors.exit(withError: error)
|
Colors.exit(withError: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extension for UIKit and SwiftUI should have different name
|
||||||
|
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||||
|
let error = ColorsToolError.extensionNamesCollision(options.extensionName)
|
||||||
|
print(error.localizedDescription)
|
||||||
|
Colors.exit(withError: error)
|
||||||
|
}
|
||||||
|
|
||||||
// Check if needed to regenerate
|
// Check if needed to regenerate
|
||||||
guard GeneratorChecker.shouldGenerate(force: options.forceGeneration,
|
guard GeneratorChecker.shouldGenerate(force: options.forceGeneration,
|
||||||
inputFilePath: options.inputFile,
|
inputFilePath: options.inputFile,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum ColorsToolError: Error {
|
enum ColorsToolError: Error {
|
||||||
|
case extensionNamesCollision(String)
|
||||||
case badFormat(String)
|
case badFormat(String)
|
||||||
case writeAsset(String)
|
case writeAsset(String)
|
||||||
case createAssetFolder(String)
|
case createAssetFolder(String)
|
||||||
@ -18,6 +19,9 @@ enum ColorsToolError: Error {
|
|||||||
|
|
||||||
var description: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
|
case .extensionNamesCollision(let extensionName):
|
||||||
|
return "error:[\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||||
|
|
||||||
case .badFormat(let info):
|
case .badFormat(let info):
|
||||||
return "error:[\(Colors.toolName)] Bad line format: \(info). Accepted format are: colorName=\"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\" \"#RGB/#ARGB\""
|
return "error:[\(Colors.toolName)] Bad line format: \(info). Accepted format are: colorName=\"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\"; colorName \"#RGB/#ARGB\" \"#RGB/#ARGB\""
|
||||||
|
|
||||||
|
@ -27,9 +27,12 @@ struct ColorsToolOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an UIColor extension. Using default extension name will generate static property.")
|
@Option(help: "Extension name. If not specified, it will generate an UIColor extension.")
|
||||||
var extensionName: String = Colors.defaultExtensionName
|
var extensionName: String = Colors.defaultExtensionName
|
||||||
|
|
||||||
|
@Option(help: "SwiftUI Extension name. If not specified, it will generate an Color extension.")
|
||||||
|
var extensionNameSwiftUI: String = Colors.defaultExtensionNameSUI
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
||||||
var extensionSuffix: String?
|
var extensionSuffix: String?
|
||||||
}
|
}
|
||||||
@ -41,6 +44,8 @@ extension ColorsToolOptions {
|
|||||||
ColorStyle(rawValue: style) ?? .all
|
ColorStyle(rawValue: style) ?? .all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - UIKit
|
||||||
|
|
||||||
var extensionFileName: String {
|
var extensionFileName: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
return "\(extensionName)+\(extensionSuffix).swift"
|
return "\(extensionName)+\(extensionSuffix).swift"
|
||||||
@ -51,4 +56,17 @@ extension ColorsToolOptions {
|
|||||||
var extensionFilePath: String {
|
var extensionFilePath: String {
|
||||||
"\(extensionOutputPath)/\(extensionFileName)"
|
"\(extensionOutputPath)/\(extensionFileName)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - SwiftUI
|
||||||
|
|
||||||
|
var extensionFileNameSwiftUI: String {
|
||||||
|
if let extensionSuffix = extensionSuffix {
|
||||||
|
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||||
|
}
|
||||||
|
return "\(extensionNameSwiftUI).swift"
|
||||||
|
}
|
||||||
|
|
||||||
|
var extensionFilePathSwiftUI: String {
|
||||||
|
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,18 @@ struct ColorExtensionGenerator {
|
|||||||
let colors: [ParsedColor]
|
let colors: [ParsedColor]
|
||||||
let extensionClassname: String
|
let extensionClassname: String
|
||||||
|
|
||||||
static func writeExtensionFile(colors: [ParsedColor], staticVar: Bool, extensionName: String, extensionFilePath: String) {
|
// MARK: - UIKit
|
||||||
|
|
||||||
|
static func writeExtensionFile(colors: [ParsedColor],
|
||||||
|
staticVar: Bool,
|
||||||
|
extensionName: String,
|
||||||
|
extensionFilePath: String,
|
||||||
|
isSwiftUI: Bool) {
|
||||||
// Create extension content
|
// Create extension content
|
||||||
let extensionContent = Self.getExtensionContent(colors: colors,
|
let extensionContent = Self.getExtensionContent(colors: colors,
|
||||||
staticVar: staticVar,
|
staticVar: staticVar,
|
||||||
extensionName: extensionName)
|
extensionName: extensionName,
|
||||||
|
isSwiftUI: isSwiftUI)
|
||||||
|
|
||||||
// Write content
|
// Write content
|
||||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||||
@ -30,20 +37,23 @@ struct ColorExtensionGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getExtensionContent(colors: [ParsedColor], staticVar: Bool, extensionName: String) -> String {
|
static func getExtensionContent(colors: [ParsedColor],
|
||||||
|
staticVar: Bool,
|
||||||
|
extensionName: String,
|
||||||
|
isSwiftUI: Bool) -> String {
|
||||||
[
|
[
|
||||||
Self.getHeader(extensionClassname: extensionName),
|
Self.getHeader(extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||||
Self.getProperties(for: colors, withStaticVar: staticVar),
|
Self.getProperties(for: colors, withStaticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||||
Self.getFooter()
|
Self.getFooter()
|
||||||
]
|
]
|
||||||
.joined(separator: "\n")
|
.joined(separator: "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getHeader(extensionClassname: String) -> String {
|
private static func getHeader(extensionClassname: String, isSwiftUI: Bool) -> String {
|
||||||
"""
|
"""
|
||||||
// Generated by ResgenSwift.\(Colors.toolName) \(ResgenSwiftVersion)
|
// Generated by ResgenSwift.\(Colors.toolName) \(ResgenSwiftVersion)
|
||||||
|
|
||||||
import UIKit
|
import \(isSwiftUI ? "SwiftUI" : "UIKit")
|
||||||
|
|
||||||
extension \(extensionClassname) {\n
|
extension \(extensionClassname) {\n
|
||||||
"""
|
"""
|
||||||
@ -55,12 +65,11 @@ struct ColorExtensionGenerator {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getProperties(for colors: [ParsedColor], withStaticVar staticVar: Bool) -> String {
|
private static func getProperties(for colors: [ParsedColor],
|
||||||
|
withStaticVar staticVar: Bool,
|
||||||
|
isSwiftUI: Bool) -> String {
|
||||||
colors.map {
|
colors.map {
|
||||||
if staticVar {
|
$0.getColorProperty(isStatic: staticVar, isSwiftUI: isSwiftUI)
|
||||||
return $0.getColorStaticProperty()
|
|
||||||
}
|
|
||||||
return $0.getColorProperty()
|
|
||||||
}
|
}
|
||||||
.joined(separator: "\n\n")
|
.joined(separator: "\n\n")
|
||||||
}
|
}
|
||||||
|
@ -72,19 +72,20 @@ struct ParsedColor {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
func getColorProperty() -> String {
|
// MARK: - UIKit
|
||||||
"""
|
|
||||||
|
func getColorProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||||
|
if isSwiftUI {
|
||||||
|
return """
|
||||||
|
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
||||||
|
\(isStatic ? "static " : "")var \(name): Color {
|
||||||
|
Color("\(name)")
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
return """
|
||||||
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
||||||
@objc var \(name): UIColor {
|
\(isStatic ? "static " : "@objc ")var \(name): UIColor {
|
||||||
UIColor(named: "\(name)")!
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
|
|
||||||
func getColorStaticProperty() -> String {
|
|
||||||
"""
|
|
||||||
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
|
||||||
static var \(name): UIColor {
|
|
||||||
UIColor(named: "\(name)")!
|
UIColor(named: "\(name)")!
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -21,9 +21,12 @@ struct FontsOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or methods")
|
@Option(help: "Tell if it will generate static properties or methods")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an UIFont extension. Using default extension name will generate static property.")
|
@Option(help: "Extension name. If not specified, it will generate an UIFont extension.")
|
||||||
var extensionName: String = Fonts.defaultExtensionName
|
var extensionName: String = Fonts.defaultExtensionName
|
||||||
|
|
||||||
|
@Option(help: "Extension name. If not specified, it will generate an Font extension.")
|
||||||
|
var extensionNameSwiftUI: String = Fonts.defaultExtensionNameSUI
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift")
|
||||||
var extensionSuffix: String = ""
|
var extensionSuffix: String = ""
|
||||||
}
|
}
|
||||||
@ -31,6 +34,9 @@ struct FontsOptions: ParsableArguments {
|
|||||||
// MARK: - Computed var
|
// MARK: - Computed var
|
||||||
|
|
||||||
extension FontsOptions {
|
extension FontsOptions {
|
||||||
|
|
||||||
|
// MARK: - UIKit
|
||||||
|
|
||||||
var extensionFileName: String {
|
var extensionFileName: String {
|
||||||
if extensionSuffix.isEmpty == false {
|
if extensionSuffix.isEmpty == false {
|
||||||
return "\(extensionName)+\(extensionSuffix).swift"
|
return "\(extensionName)+\(extensionSuffix).swift"
|
||||||
@ -41,4 +47,17 @@ extension FontsOptions {
|
|||||||
var extensionFilePath: String {
|
var extensionFilePath: String {
|
||||||
"\(extensionOutputPath)/\(extensionFileName)"
|
"\(extensionOutputPath)/\(extensionFileName)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - SwiftUI
|
||||||
|
|
||||||
|
var extensionFileNameSwiftUI: String {
|
||||||
|
if extensionSuffix.isEmpty == false {
|
||||||
|
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||||
|
}
|
||||||
|
return "\(extensionNameSwiftUI).swift"
|
||||||
|
}
|
||||||
|
|
||||||
|
var extensionFilePathSwiftUI: String {
|
||||||
|
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ struct Fonts: ParsableCommand {
|
|||||||
|
|
||||||
static let toolName = "Fonts"
|
static let toolName = "Fonts"
|
||||||
static let defaultExtensionName = "UIFont"
|
static let defaultExtensionName = "UIFont"
|
||||||
|
static let defaultExtensionNameSUI = "Font"
|
||||||
|
|
||||||
// MARK: - Command Options
|
// MARK: - Command Options
|
||||||
|
|
||||||
@ -50,7 +51,14 @@ struct Fonts: ParsableCommand {
|
|||||||
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
extensionName: options.extensionName,
|
extensionName: options.extensionName,
|
||||||
extensionFilePath: options.extensionFilePath)
|
extensionFilePath: options.extensionFilePath,
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
|
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
||||||
|
staticVar: options.staticMembers,
|
||||||
|
extensionName: options.extensionNameSwiftUI,
|
||||||
|
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||||
|
isSwiftUI: true)
|
||||||
|
|
||||||
print("Info.plist information:")
|
print("Info.plist information:")
|
||||||
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames))")
|
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames))")
|
||||||
@ -70,6 +78,13 @@ struct Fonts: ParsableCommand {
|
|||||||
Fonts.exit(withError: error)
|
Fonts.exit(withError: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extension for UIKit and SwiftUI should have different name
|
||||||
|
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||||
|
let error = FontsToolError.extensionNamesCollision(options.extensionName)
|
||||||
|
print(error.localizedDescription)
|
||||||
|
Fonts.exit(withError: error)
|
||||||
|
}
|
||||||
|
|
||||||
// Check if needed to regenerate
|
// Check if needed to regenerate
|
||||||
guard GeneratorChecker.shouldGenerate(force: options.forceGeneration,
|
guard GeneratorChecker.shouldGenerate(force: options.forceGeneration,
|
||||||
inputFilePath: options.inputFile,
|
inputFilePath: options.inputFile,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum FontsToolError: Error {
|
enum FontsToolError: Error {
|
||||||
|
case extensionNamesCollision(String)
|
||||||
case fcScan(String, Int32, String?)
|
case fcScan(String, Int32, String?)
|
||||||
case inputFolderNotFound(String)
|
case inputFolderNotFound(String)
|
||||||
case fileNotExists(String)
|
case fileNotExists(String)
|
||||||
@ -15,6 +16,9 @@ enum FontsToolError: Error {
|
|||||||
|
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
switch self {
|
switch self {
|
||||||
|
case .extensionNamesCollision(let extensionName):
|
||||||
|
return "error:[\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||||
|
|
||||||
case .fcScan(let path, let code, let output):
|
case .fcScan(let path, let code, let output):
|
||||||
return "error:[\(Fonts.toolName)] Error while getting fontName (fc-scan --format %{postscriptname} \(path). fc-scan exit with \(code) and output is: \(output ?? "no output")"
|
return "error:[\(Fonts.toolName)] Error while getting fontName (fc-scan --format %{postscriptname} \(path). fc-scan exit with \(code) and output is: \(output ?? "no output")"
|
||||||
|
|
||||||
|
@ -9,12 +9,28 @@ import Foundation
|
|||||||
import ToolCore
|
import ToolCore
|
||||||
|
|
||||||
class FontExtensionGenerator {
|
class FontExtensionGenerator {
|
||||||
|
|
||||||
|
private static func getFontNameEnum(fontsNames: [String]) -> String {
|
||||||
|
var enumDefinition = " enum FontName: String {\n"
|
||||||
|
|
||||||
|
fontsNames.forEach {
|
||||||
|
enumDefinition += " case \($0.fontNameSanitize) = \"\($0)\"\n"
|
||||||
|
}
|
||||||
|
enumDefinition += " }\n"
|
||||||
|
|
||||||
|
return enumDefinition
|
||||||
|
}
|
||||||
|
|
||||||
static func writeExtensionFile(fontsNames: [String], staticVar: Bool, extensionName: String, extensionFilePath: String) {
|
static func writeExtensionFile(fontsNames: [String],
|
||||||
|
staticVar: Bool,
|
||||||
|
extensionName: String,
|
||||||
|
extensionFilePath: String,
|
||||||
|
isSwiftUI: Bool) {
|
||||||
// Create extension content
|
// Create extension content
|
||||||
let extensionContent = Self.getExtensionContent(fontsNames: fontsNames,
|
let extensionContent = Self.getExtensionContent(fontsNames: fontsNames,
|
||||||
staticVar: staticVar,
|
staticVar: staticVar,
|
||||||
extensionName: extensionName)
|
extensionName: extensionName,
|
||||||
|
isSwiftUI: isSwiftUI)
|
||||||
|
|
||||||
// Write content
|
// Write content
|
||||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||||
@ -27,48 +43,36 @@ class FontExtensionGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getExtensionContent(fontsNames: [String], staticVar: Bool, extensionName: String) -> String {
|
static func getExtensionContent(fontsNames: [String],
|
||||||
|
staticVar: Bool,
|
||||||
|
extensionName: String,
|
||||||
|
isSwiftUI: Bool) -> String {
|
||||||
[
|
[
|
||||||
Self.getHeader(extensionClassname: extensionName),
|
Self.getHeader(extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||||
Self.getFontNameEnum(fontsNames: fontsNames),
|
Self.getFontNameEnum(fontsNames: fontsNames),
|
||||||
Self.getFontMethods(fontsNames: fontsNames, staticVar: staticVar),
|
Self.getFontMethods(fontsNames: fontsNames, staticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||||
Self.getFooter()
|
Self.getFooter()
|
||||||
]
|
]
|
||||||
.joined(separator: "\n")
|
.joined(separator: "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getHeader(extensionClassname: String) -> String {
|
private static func getHeader(extensionClassname: String, isSwiftUI: Bool) -> String {
|
||||||
"""
|
"""
|
||||||
// Generated by ResgenSwift.\(Fonts.toolName) \(ResgenSwiftVersion)
|
// Generated by ResgenSwift.\(Fonts.toolName) \(ResgenSwiftVersion)
|
||||||
|
|
||||||
import UIKit
|
import \(isSwiftUI ? "SwiftUI" : "UIKit")
|
||||||
|
|
||||||
extension \(extensionClassname) {\n
|
extension \(extensionClassname) {\n
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getFontNameEnum(fontsNames: [String]) -> String {
|
private static func getFontMethods(fontsNames: [FontName], staticVar: Bool, isSwiftUI: Bool) -> String {
|
||||||
var enumDefinition = " enum FontName: String {\n"
|
|
||||||
|
|
||||||
fontsNames.forEach {
|
|
||||||
enumDefinition += " case \($0.fontNameSanitize) = \"\($0)\"\n"
|
|
||||||
}
|
|
||||||
enumDefinition += " }\n"
|
|
||||||
|
|
||||||
return enumDefinition
|
|
||||||
}
|
|
||||||
|
|
||||||
private static func getFontMethods(fontsNames: [FontName], staticVar: Bool) -> String {
|
|
||||||
let pragma = " // MARK: - Getter"
|
let pragma = " // MARK: - Getter"
|
||||||
|
|
||||||
var propertiesOrMethods: [String] = fontsNames
|
var propertiesOrMethods: [String] = fontsNames
|
||||||
.unique()
|
.unique()
|
||||||
.map {
|
.map {
|
||||||
if staticVar {
|
$0.getProperty(isStatic: staticVar, isSwiftUI: isSwiftUI)
|
||||||
return $0.staticProperty
|
|
||||||
} else {
|
|
||||||
return $0.method
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
propertiesOrMethods.insert(pragma, at: 0)
|
propertiesOrMethods.insert(pragma, at: 0)
|
||||||
|
@ -14,19 +14,33 @@ extension FontName {
|
|||||||
self.removeCharacters(from: "[]+-_")
|
self.removeCharacters(from: "[]+-_")
|
||||||
}
|
}
|
||||||
|
|
||||||
var method: String {
|
func getProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||||
"""
|
if isSwiftUI {
|
||||||
|
if isStatic {
|
||||||
|
return """
|
||||||
|
static let \(fontNameSanitize): ((_ size: CGFloat) -> Font) = { size in
|
||||||
|
Font.custom(FontName.\(fontNameSanitize).rawValue, size: size)
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
return """
|
||||||
|
func \(fontNameSanitize)(withSize size: CGFloat) -> Font {
|
||||||
|
Font.custom(FontName.\(fontNameSanitize).rawValue, size: size)
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
// UIKit
|
||||||
|
if isStatic {
|
||||||
|
return """
|
||||||
|
static let \(fontNameSanitize): ((_ size: CGFloat) -> UIFont) = { size in
|
||||||
|
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
return """
|
||||||
func \(fontNameSanitize)(withSize size: CGFloat) -> UIFont {
|
func \(fontNameSanitize)(withSize size: CGFloat) -> UIFont {
|
||||||
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
var staticProperty: String {
|
|
||||||
"""
|
|
||||||
static let \(fontNameSanitize): ((_ size: CGFloat) -> UIFont) = { size in
|
|
||||||
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let xcassetsPath: String
|
let xcassetsPath: String
|
||||||
let extensionOutputPath: String
|
let extensionOutputPath: String
|
||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
|
let extensionNameSwiftUI: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
private let staticMembers: Bool?
|
private let staticMembers: Bool?
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Xcassets path: \(xcassetsPath)
|
- Xcassets path: \(xcassetsPath)
|
||||||
- Extension output path: \(extensionOutputPath)
|
- Extension output path: \(extensionOutputPath)
|
||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
|
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -72,6 +74,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let inputFile: String
|
let inputFile: String
|
||||||
let extensionOutputPath: String
|
let extensionOutputPath: String
|
||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
|
let extensionNameSwiftUI: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
private let staticMembers: Bool?
|
private let staticMembers: Bool?
|
||||||
|
|
||||||
@ -88,6 +91,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Input file: \(inputFile)
|
- Input file: \(inputFile)
|
||||||
- Extension output path: \(extensionOutputPath)
|
- Extension output path: \(extensionOutputPath)
|
||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
|
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -98,6 +102,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let xcassetsPath: String
|
let xcassetsPath: String
|
||||||
let extensionOutputPath: String
|
let extensionOutputPath: String
|
||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
|
let extensionNameSwiftUI: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
private let staticMembers: Bool?
|
private let staticMembers: Bool?
|
||||||
|
|
||||||
@ -115,6 +120,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Xcassets path: \(xcassetsPath)
|
- Xcassets path: \(xcassetsPath)
|
||||||
- Extension output path: \(extensionOutputPath)
|
- Extension output path: \(extensionOutputPath)
|
||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
|
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,12 @@ extension ColorsConfiguration: Runnable {
|
|||||||
extensionName
|
extensionName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||||
|
args += [
|
||||||
|
"--extension-name-swift-ui",
|
||||||
|
extensionNameSwiftUI
|
||||||
|
]
|
||||||
|
}
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
args += [
|
args += [
|
||||||
"--extension-suffix",
|
"--extension-suffix",
|
||||||
|
@ -29,6 +29,12 @@ extension FontsConfiguration: Runnable {
|
|||||||
extensionName
|
extensionName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||||
|
args += [
|
||||||
|
"--extension-name-swift-ui",
|
||||||
|
extensionNameSwiftUI
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
args += [
|
args += [
|
||||||
|
@ -31,6 +31,12 @@ extension ImagesConfiguration: Runnable {
|
|||||||
extensionName
|
extensionName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
||||||
|
args += [
|
||||||
|
"--extension-name-swift-ui",
|
||||||
|
extensionNameSwiftUI
|
||||||
|
]
|
||||||
|
}
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
args += [
|
args += [
|
||||||
"--extension-suffix",
|
"--extension-suffix",
|
||||||
|
@ -10,18 +10,20 @@ import Foundation
|
|||||||
|
|
||||||
class ImageExtensionGenerator {
|
class ImageExtensionGenerator {
|
||||||
|
|
||||||
// MARK: - pragm
|
// MARK: - UIKit
|
||||||
|
|
||||||
static func generateExtensionFile(images: [ParsedImage],
|
static func generateExtensionFile(images: [ParsedImage],
|
||||||
staticVar: Bool,
|
staticVar: Bool,
|
||||||
inputFilename: String,
|
inputFilename: String,
|
||||||
extensionName: String,
|
extensionName: String,
|
||||||
extensionFilePath: String) {
|
extensionFilePath: String,
|
||||||
|
isSwiftUI: Bool) {
|
||||||
// Create extension conten1t
|
// Create extension conten1t
|
||||||
let extensionContent = Self.getExtensionContent(images: images,
|
let extensionContent = Self.getExtensionContent(images: images,
|
||||||
staticVar: staticVar,
|
staticVar: staticVar,
|
||||||
extensionName: extensionName,
|
extensionName: extensionName,
|
||||||
inputFilename: inputFilename)
|
inputFilename: inputFilename,
|
||||||
|
isSwiftUI: isSwiftUI)
|
||||||
|
|
||||||
// Write content
|
// Write content
|
||||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||||
@ -34,38 +36,35 @@ class ImageExtensionGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Extension content
|
static func getExtensionContent(images: [ParsedImage],
|
||||||
|
staticVar: Bool,
|
||||||
static func getExtensionContent(images: [ParsedImage], staticVar: Bool, extensionName: String, inputFilename: String) -> String {
|
extensionName: String,
|
||||||
|
inputFilename: String,
|
||||||
|
isSwiftUI: Bool) -> String {
|
||||||
[
|
[
|
||||||
Self.getHeader(inputFilename: inputFilename, extensionClassname: extensionName),
|
Self.getHeader(inputFilename: inputFilename, extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||||
Self.getProperties(images: images, staticVar: staticVar),
|
Self.getProperties(images: images, staticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||||
Self.getFooter()
|
Self.getFooter()
|
||||||
]
|
]
|
||||||
.joined(separator: "\n")
|
.joined(separator: "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Extension part
|
private static func getHeader(inputFilename: String,
|
||||||
|
extensionClassname: String,
|
||||||
private static func getHeader(inputFilename: String, extensionClassname: String) -> String {
|
isSwiftUI: Bool) -> String {
|
||||||
"""
|
"""
|
||||||
// Generated by ResgenSwift.\(Images.toolName) \(ResgenSwiftVersion)
|
// Generated by ResgenSwift.\(Images.toolName) \(ResgenSwiftVersion)
|
||||||
// Images from \(inputFilename)
|
// Images from \(inputFilename)
|
||||||
|
|
||||||
import UIKit
|
import \(isSwiftUI ? "SwiftUI" : "UIKit")
|
||||||
|
|
||||||
extension \(extensionClassname) {
|
extension \(extensionClassname) {
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getProperties(images: [ParsedImage], staticVar: Bool) -> String {
|
private static func getProperties(images: [ParsedImage], staticVar: Bool, isSwiftUI: Bool) -> String {
|
||||||
if staticVar {
|
images
|
||||||
return images
|
.map { "\n\($0.getImageProperty(isStatic: staticVar, isSwiftUI: isSwiftUI))" }
|
||||||
.map { "\n\($0.getStaticImageProperty())" }
|
|
||||||
.joined(separator: "\n")
|
|
||||||
}
|
|
||||||
return images
|
|
||||||
.map { "\n\($0.getImageProperty())" }
|
|
||||||
.joined(separator: "\n")
|
.joined(separator: "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ struct Images: ParsableCommand {
|
|||||||
|
|
||||||
static let toolName = "Images"
|
static let toolName = "Images"
|
||||||
static let defaultExtensionName = "UIImage"
|
static let defaultExtensionName = "UIImage"
|
||||||
|
static let defaultExtensionNameSUI = "Image"
|
||||||
|
|
||||||
// MARK: - Command Options
|
// MARK: - Command Options
|
||||||
|
|
||||||
@ -56,8 +57,15 @@ struct Images: ParsableCommand {
|
|||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
inputFilename: options.inputFilenameWithoutExt,
|
inputFilename: options.inputFilenameWithoutExt,
|
||||||
extensionName: options.extensionName,
|
extensionName: options.extensionName,
|
||||||
extensionFilePath: options.extensionFilePath)
|
extensionFilePath: options.extensionFilePath,
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
|
ImageExtensionGenerator.generateExtensionFile(images: imagesToGenerate,
|
||||||
|
staticVar: options.staticMembers,
|
||||||
|
inputFilename: options.inputFilenameWithoutExt,
|
||||||
|
extensionName: options.extensionNameSwiftUI,
|
||||||
|
extensionFilePath: options.extensionFilePathSwiftUI,
|
||||||
|
isSwiftUI: true)
|
||||||
|
|
||||||
print("[\(Self.toolName)] Images generated")
|
print("[\(Self.toolName)] Images generated")
|
||||||
}
|
}
|
||||||
@ -81,6 +89,13 @@ struct Images: ParsableCommand {
|
|||||||
// RSVG-Converter
|
// RSVG-Converter
|
||||||
_ = Images.getSvgConverterPath()
|
_ = Images.getSvgConverterPath()
|
||||||
|
|
||||||
|
// Extension for UIKit and SwiftUI should have different name
|
||||||
|
guard options.extensionName != options.extensionNameSwiftUI else {
|
||||||
|
let error = ImagesError.extensionNamesCollision(options.extensionName)
|
||||||
|
print(error.localizedDescription)
|
||||||
|
Images.exit(withError: error)
|
||||||
|
}
|
||||||
|
|
||||||
// Check if needed to regenerate
|
// Check if needed to regenerate
|
||||||
guard GeneratorChecker.shouldGenerate(force: options.forceExecution,
|
guard GeneratorChecker.shouldGenerate(force: options.forceExecution,
|
||||||
inputFilePath: options.inputFile,
|
inputFilePath: options.inputFile,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum ImagesError: Error {
|
enum ImagesError: Error {
|
||||||
|
case extensionNamesCollision(String)
|
||||||
case inputFolderNotFound(String)
|
case inputFolderNotFound(String)
|
||||||
case fileNotExists(String)
|
case fileNotExists(String)
|
||||||
case unknownImageExtension(String)
|
case unknownImageExtension(String)
|
||||||
@ -19,6 +20,9 @@ enum ImagesError: Error {
|
|||||||
|
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
switch self {
|
switch self {
|
||||||
|
case .extensionNamesCollision(let extensionName):
|
||||||
|
return "error:[\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||||
|
|
||||||
case .inputFolderNotFound(let inputFolder):
|
case .inputFolderNotFound(let inputFolder):
|
||||||
return " error:[\(Images.toolName)] Input folder not found: \(inputFolder)"
|
return " error:[\(Images.toolName)] Input folder not found: \(inputFolder)"
|
||||||
|
|
||||||
|
@ -27,9 +27,12 @@ struct ImagesOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an UIImage extension. Using default extension name will generate static property.")
|
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
||||||
var extensionName: String = Images.defaultExtensionName
|
var extensionName: String = Images.defaultExtensionName
|
||||||
|
|
||||||
|
@Option(help: "Extension name. If not specified, it will generate an Image extension.")
|
||||||
|
var extensionNameSwiftUI: String = Images.defaultExtensionNameSUI
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
||||||
var extensionSuffix: String?
|
var extensionSuffix: String?
|
||||||
}
|
}
|
||||||
@ -37,6 +40,9 @@ struct ImagesOptions: ParsableArguments {
|
|||||||
// MARK: - Computed var
|
// MARK: - Computed var
|
||||||
|
|
||||||
extension ImagesOptions {
|
extension ImagesOptions {
|
||||||
|
|
||||||
|
// MARK: - UIKit
|
||||||
|
|
||||||
var extensionFileName: String {
|
var extensionFileName: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
return "\(extensionName)+\(extensionSuffix).swift"
|
return "\(extensionName)+\(extensionSuffix).swift"
|
||||||
@ -48,6 +54,21 @@ extension ImagesOptions {
|
|||||||
"\(extensionOutputPath)/\(extensionFileName)"
|
"\(extensionOutputPath)/\(extensionFileName)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - SwiftUI
|
||||||
|
|
||||||
|
var extensionFileNameSwiftUI: String {
|
||||||
|
if let extensionSuffix = extensionSuffix {
|
||||||
|
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
||||||
|
}
|
||||||
|
return "\(extensionNameSwiftUI).swift"
|
||||||
|
}
|
||||||
|
|
||||||
|
var extensionFilePathSwiftUI: String {
|
||||||
|
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: -
|
||||||
|
|
||||||
var inputFilenameWithoutExt: String {
|
var inputFilenameWithoutExt: String {
|
||||||
URL(fileURLWithPath: inputFile)
|
URL(fileURLWithPath: inputFile)
|
||||||
.deletingPathExtension()
|
.deletingPathExtension()
|
||||||
|
@ -72,17 +72,16 @@ struct ParsedImage {
|
|||||||
|
|
||||||
// MARK: - Extension property
|
// MARK: - Extension property
|
||||||
|
|
||||||
func getImageProperty() -> String {
|
func getImageProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||||
"""
|
if isSwiftUI {
|
||||||
var \(name): UIImage {
|
return """
|
||||||
UIImage(named: "\(name)")!
|
\(isStatic ? "static ": "")var \(name): Image {
|
||||||
}
|
Image("\(name)")
|
||||||
"""
|
}
|
||||||
}
|
"""
|
||||||
|
}
|
||||||
func getStaticImageProperty() -> String {
|
return """
|
||||||
"""
|
\(isStatic ? "static ": "")var \(name): UIImage {
|
||||||
static var \(name): UIImage {
|
|
||||||
UIImage(named: "\(name)")!
|
UIImage(named: "\(name)")!
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -33,7 +33,7 @@ struct StringiumOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an String extension. Using default extension name will generate static property.")
|
@Option(help: "Extension name. If not specified, it will generate an String extension.")
|
||||||
var extensionName: String = Stringium.defaultExtensionName
|
var extensionName: String = Stringium.defaultExtensionName
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+{extensionSuffix}.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+{extensionSuffix}.swift")
|
||||||
|
@ -24,7 +24,7 @@ struct TagsOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate a Tag extension. Using default extension name will generate static property.")
|
@Option(help: "Extension name. If not specified, it will generate a Tag extension.")
|
||||||
var extensionName: String = Tags.defaultExtensionName
|
var extensionName: String = Tags.defaultExtensionName
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Tag{extensionSuffix}.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Tag{extensionSuffix}.swift")
|
||||||
|
@ -23,7 +23,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
|||||||
// When
|
// When
|
||||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||||
staticVar: false,
|
staticVar: false,
|
||||||
extensionName: "GenColors")
|
extensionName: "GenColors",
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -58,7 +59,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
|||||||
// When
|
// When
|
||||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||||
staticVar: true,
|
staticVar: true,
|
||||||
extensionName: "GenColor")
|
extensionName: "GenColor",
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
@ -17,7 +17,7 @@ final class ParsedColorTests: XCTestCase {
|
|||||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = color.getColorProperty()
|
let property = color.getColorProperty(isStatic: false, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -35,7 +35,7 @@ final class ParsedColorTests: XCTestCase {
|
|||||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = color.getColorStaticProperty()
|
let property = color.getColorProperty(isStatic: true, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
@ -23,7 +23,8 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
|||||||
// When
|
// When
|
||||||
let extensionContent = FontExtensionGenerator.getExtensionContent(fontsNames: fontNames,
|
let extensionContent = FontExtensionGenerator.getExtensionContent(fontsNames: fontNames,
|
||||||
staticVar: false,
|
staticVar: false,
|
||||||
extensionName: "GenFonts")
|
extensionName: "GenFonts",
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
@ -17,7 +17,7 @@ final class FontNameTests: XCTestCase {
|
|||||||
let fontName: FontName = "CircularStdBold"
|
let fontName: FontName = "CircularStdBold"
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.staticProperty
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -34,7 +34,7 @@ final class FontNameTests: XCTestCase {
|
|||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.staticProperty
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -51,7 +51,7 @@ final class FontNameTests: XCTestCase {
|
|||||||
let fontName: FontName = "CircularStdBold"
|
let fontName: FontName = "CircularStdBold"
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.method
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -68,7 +68,7 @@ final class FontNameTests: XCTestCase {
|
|||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.method
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
@ -24,7 +24,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
|||||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||||
staticVar: false,
|
staticVar: false,
|
||||||
extensionName: "GenImages",
|
extensionName: "GenImages",
|
||||||
inputFilename: "myInputFilename")
|
inputFilename: "myInputFilename",
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -59,7 +60,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
|||||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||||
staticVar: true,
|
staticVar: true,
|
||||||
extensionName: "GenImages",
|
extensionName: "GenImages",
|
||||||
inputFilename: "myInputFilename")
|
inputFilename: "myInputFilename",
|
||||||
|
isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
@ -43,7 +43,7 @@ final class ParsedImageTests: XCTestCase {
|
|||||||
height: 10)
|
height: 10)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = parsedImage.getImageProperty()
|
let property = parsedImage.getImageProperty(isStatic: false, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
@ -64,7 +64,7 @@ final class ParsedImageTests: XCTestCase {
|
|||||||
height: 10)
|
height: 10)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = parsedImage.getStaticImageProperty()
|
let property = parsedImage.getImageProperty(isStatic: true, isSwiftUI: false)
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
let expect = """
|
let expect = """
|
||||||
|
Reference in New Issue
Block a user