Add visibility parameters to control scope of generated extension
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@ -50,8 +50,8 @@ struct Analytics: ParsableCommand {
|
||||
target: options.target,
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath
|
||||
outputFile: options.outputFile,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
|
||||
print("[\(Self.toolName)] Analytics generated")
|
||||
@ -79,7 +79,7 @@ struct Analytics: ParsableCommand {
|
||||
guard GeneratorChecker.shouldGenerate(
|
||||
force: options.forceGeneration,
|
||||
inputFilePath: options.inputFile,
|
||||
extensionFilePath: options.extensionFilePath
|
||||
extensionFilePath: options.outputFile
|
||||
) else {
|
||||
print("[\(Self.toolName)] Analytics are already up to date :) ")
|
||||
return false
|
||||
|
@ -7,45 +7,43 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
struct AnalyticsOptions: ParsableArguments {
|
||||
|
||||
@Flag(name: [.customShort("f"), .customShort("F")], help: "Should force generation")
|
||||
@Flag(
|
||||
name: [.customShort("f"), .customShort("F")],
|
||||
help: "Should force generation"
|
||||
)
|
||||
var forceGeneration = false
|
||||
|
||||
@Argument(help: "Input files where tags ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Argument(
|
||||
help: "Input files where tags ared defined.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var inputFile: String
|
||||
|
||||
@Option(help: "Target(s) analytics to generate. (\"matomo\" | \"firebase\")")
|
||||
@Option(
|
||||
help: "Target(s) analytics to generate. (\"matomo\" | \"firebase\")",
|
||||
completion: .list(["matotmo", "firebase"])
|
||||
)
|
||||
var target: String
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
@Option(
|
||||
help: "Where to generate the analytics manager (path with filename)",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var outputFile: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Extension name. If not specified, it will generate a Analytics extension.")
|
||||
var extensionName: String = Analytics.defaultExtensionName
|
||||
|
||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Analytics{extensionSuffix}.swift")
|
||||
var extensionSuffix: String?
|
||||
}
|
||||
|
||||
// MARK: - Computed var
|
||||
|
||||
extension AnalyticsOptions {
|
||||
|
||||
var extensionFileName: String {
|
||||
if let extensionSuffix {
|
||||
return "\(extensionName)+\(extensionSuffix).swift"
|
||||
}
|
||||
return "\(extensionName).swift"
|
||||
}
|
||||
|
||||
var extensionFilePath: String {
|
||||
"\(extensionOutputPath)/\(extensionFileName)"
|
||||
}
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ enum AnalyticsGenerator {
|
||||
target: String,
|
||||
tags: [String],
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
extensionFilePath: String
|
||||
outputFile: String,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Get target type from enum
|
||||
let targetsString: [String] = target.components(separatedBy: " ")
|
||||
@ -44,15 +44,15 @@ enum AnalyticsGenerator {
|
||||
sections: sections,
|
||||
tags: tags,
|
||||
staticVar: staticVar,
|
||||
extensionName: extensionName
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
let extensionFilePathURL = URL(fileURLWithPath: extensionFilePath)
|
||||
let outputFilePathURL = URL(fileURLWithPath: outputFile)
|
||||
do {
|
||||
try extensionFileContent.write(to: extensionFilePathURL, atomically: false, encoding: .utf8)
|
||||
try extensionFileContent.write(to: outputFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch {
|
||||
let error = AnalyticsError.writeFile(extensionFilePath, error.localizedDescription)
|
||||
let error = AnalyticsError.writeFile(outputFile, error.localizedDescription)
|
||||
print(error.description)
|
||||
Analytics.exit(withError: error)
|
||||
}
|
||||
@ -65,18 +65,19 @@ enum AnalyticsGenerator {
|
||||
sections: [AnalyticsCategory],
|
||||
tags: [String],
|
||||
staticVar: Bool,
|
||||
extensionName: String
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
getHeader(
|
||||
targets: targets,
|
||||
extensionClassname: extensionName,
|
||||
staticVar: staticVar
|
||||
staticVar: staticVar,
|
||||
visibility: visibility
|
||||
),
|
||||
getProperties(
|
||||
sections: sections,
|
||||
tags: tags,
|
||||
staticVar: staticVar
|
||||
staticVar: staticVar,
|
||||
visibility: visibility
|
||||
),
|
||||
getFooter()
|
||||
]
|
||||
@ -87,23 +88,23 @@ enum AnalyticsGenerator {
|
||||
|
||||
private static func getHeader(
|
||||
targets: [TrackerType],
|
||||
extensionClassname: String,
|
||||
staticVar: Bool
|
||||
staticVar: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
"""
|
||||
// Generated by ResgenSwift.\(Analytics.toolName) \(ResgenSwiftVersion)
|
||||
|
||||
\(Self.getImport(targets: targets))
|
||||
|
||||
\(Self.getAnalyticsProtocol(targets: targets))
|
||||
\(Self.getAnalyticsProtocol(targets: targets, visibility: visibility))
|
||||
|
||||
\(Self.getTrackerTypeEnum(targets: targets))
|
||||
\(Self.getTrackerTypeEnum(targets: targets, visibility: visibility))
|
||||
|
||||
// MARK: - Manager
|
||||
|
||||
class AnalyticsManager {
|
||||
\(visibility) class AnalyticsManager {
|
||||
|
||||
static var shared = AnalyticsManager()
|
||||
\(visibility) static var shared = AnalyticsManager()
|
||||
|
||||
private init() {}
|
||||
|
||||
@ -111,15 +112,18 @@ enum AnalyticsGenerator {
|
||||
|
||||
var managers: [TrackerType: AnalyticsManagerProtocol] = [:]
|
||||
|
||||
\(Self.getEnabledContent())
|
||||
\(Self.getEnabledContent(visibility: visibility))
|
||||
|
||||
\(Self.getAnalyticsProperties(targets: targets))
|
||||
\(Self.getAnalyticsProperties(targets: targets, visibility: visibility))
|
||||
|
||||
\(Self.getPrivateLogFunction())
|
||||
"""
|
||||
}
|
||||
|
||||
private static func getTrackerTypeEnum(targets: [TrackerType]) -> String {
|
||||
private static func getTrackerTypeEnum(
|
||||
targets: [TrackerType],
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
var result: [String] = []
|
||||
targets.forEach { type in
|
||||
result.append(" case \(type)")
|
||||
@ -128,14 +132,16 @@ enum AnalyticsGenerator {
|
||||
return """
|
||||
// MARK: - Traker Type
|
||||
|
||||
enum TrackerType: CaseIterable {
|
||||
\(visibility) enum TrackerType: CaseIterable {
|
||||
|
||||
\(result.joined(separator: "\n"))
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
private static func getEnabledContent() -> String {
|
||||
private static func getEnabledContent(
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
"""
|
||||
private var isEnabled: Bool {
|
||||
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" {
|
||||
@ -157,11 +163,11 @@ enum AnalyticsGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
\(visibility) func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: true, analytics)
|
||||
}
|
||||
|
||||
func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
\(visibility) func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: false, analytics)
|
||||
}
|
||||
"""
|
||||
@ -223,15 +229,18 @@ enum AnalyticsGenerator {
|
||||
"""
|
||||
}
|
||||
|
||||
private static func getAnalyticsProperties(targets: [TrackerType]) -> String {
|
||||
private static func getAnalyticsProperties(
|
||||
targets: [TrackerType],
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
var header = ""
|
||||
var content: [String] = []
|
||||
let footer = " }"
|
||||
|
||||
if targets.contains(TrackerType.matomo) {
|
||||
header = "func configure(siteId: String, url: String) {"
|
||||
header = "\(visibility) func configure(siteId: String, url: String) {"
|
||||
} else if targets.contains(TrackerType.firebase) {
|
||||
header = "func configure() {"
|
||||
header = "\(visibility) func configure() {"
|
||||
}
|
||||
|
||||
if targets.contains(TrackerType.matomo) {
|
||||
@ -255,11 +264,14 @@ enum AnalyticsGenerator {
|
||||
.joined(separator: "\n")
|
||||
}
|
||||
|
||||
private static func getAnalyticsProtocol(targets: [TrackerType]) -> String {
|
||||
private static func getAnalyticsProtocol(
|
||||
targets: [TrackerType],
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
let proto = """
|
||||
// MARK: - Protocol
|
||||
|
||||
protocol AnalyticsManagerProtocol {
|
||||
\(visibility) protocol AnalyticsManagerProtocol {
|
||||
|
||||
func logScreen(
|
||||
name: String,
|
||||
@ -294,7 +306,8 @@ enum AnalyticsGenerator {
|
||||
private static func getProperties(
|
||||
sections: [AnalyticsCategory],
|
||||
tags: [String],
|
||||
staticVar: Bool
|
||||
staticVar: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
sections
|
||||
.compactMap { section in
|
||||
@ -310,9 +323,9 @@ enum AnalyticsGenerator {
|
||||
}
|
||||
|
||||
if staticVar {
|
||||
res += "\n\n\(definition.getStaticProperty())"
|
||||
res += "\n\n\(definition.getStaticProperty(visibility: visibility))"
|
||||
} else {
|
||||
res += "\n\n\(definition.getProperty())"
|
||||
res += "\n\n\(definition.getProperty(visibility: visibility))"
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
@ -169,19 +169,19 @@ class AnalyticsDefinition {
|
||||
|
||||
// MARK: - Raw strings
|
||||
|
||||
func getProperty() -> String {
|
||||
func getProperty(visibility: ExtensionVisibility) -> String {
|
||||
replaceIn()
|
||||
return """
|
||||
func \(getFuncName())\(getParameters()) {
|
||||
\(visibility) func \(getFuncName())\(getParameters()) {
|
||||
\(getlogFunction())
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
func getStaticProperty() -> String {
|
||||
func getStaticProperty(visibility: ExtensionVisibility) -> String {
|
||||
replaceIn()
|
||||
return """
|
||||
static func \(getFuncName())\(getParameters()) {
|
||||
\(visibility) static func \(getFuncName())\(getParameters()) {
|
||||
AnalyticsManager.shared.\(getlogFunction())
|
||||
}
|
||||
"""
|
||||
|
@ -62,7 +62,8 @@ struct Colors: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: extensionName,
|
||||
extensionFilePath: extensionFilePath,
|
||||
isSwiftUI: true
|
||||
isSwiftUI: true,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
@ -74,7 +75,8 @@ struct Colors: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: extensionNameUIKit,
|
||||
extensionFilePath: extensionFilePathUIKit,
|
||||
isSwiftUI: false
|
||||
isSwiftUI: false,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -7,27 +7,47 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
struct ColorsToolOptions: ParsableArguments {
|
||||
|
||||
@Flag(name: [.customShort("f"), .customShort("F")], help: "Should force generation")
|
||||
@Flag(
|
||||
name: [.customShort("f"), .customShort("F")],
|
||||
help: "Should force generation"
|
||||
)
|
||||
var forceGeneration = false
|
||||
|
||||
@Argument(help: "Input files where colors ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Argument(
|
||||
help: "Input files where colors ared defined.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var inputFile: String
|
||||
|
||||
@Option(help: "Color style to generate: light for light colors only, or all for dark and light colors")
|
||||
var style: ColorStyle
|
||||
|
||||
@Option(help: "Path of xcassets where to generate colors", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
help: "Path of xcassets where to generate colors",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var xcassetsPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
|
||||
@Option(
|
||||
help: "Path where to generate the extension.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var extensionOutputPath: String?
|
||||
|
||||
@Option(help: "SwiftUI extension name. If not specified, no extension will be generated.")
|
||||
|
@ -20,14 +20,16 @@ struct ColorExtensionGenerator {
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
extensionFilePath: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Create extension content
|
||||
let extensionContent = Self.getExtensionContent(
|
||||
colors: colors,
|
||||
staticVar: staticVar,
|
||||
extensionName: extensionName,
|
||||
isSwiftUI: isSwiftUI
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
@ -45,11 +47,20 @@ struct ColorExtensionGenerator {
|
||||
colors: [ParsedColor],
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
Self.getHeader(extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||
Self.getProperties(for: colors, withStaticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||
Self.getHeader(
|
||||
extensionClassname: extensionName,
|
||||
isSwiftUI: isSwiftUI
|
||||
),
|
||||
Self.getProperties(
|
||||
for: colors,
|
||||
withStaticVar: staticVar,
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFooter()
|
||||
]
|
||||
.joined(separator: "\n")
|
||||
@ -75,10 +86,15 @@ struct ColorExtensionGenerator {
|
||||
private static func getProperties(
|
||||
for colors: [ParsedColor],
|
||||
withStaticVar staticVar: Bool,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
colors.map {
|
||||
$0.getColorProperty(isStatic: staticVar, isSwiftUI: isSwiftUI)
|
||||
$0.getColorProperty(
|
||||
isStatic: staticVar,
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
)
|
||||
}
|
||||
.joined(separator: "\n\n")
|
||||
}
|
||||
|
@ -6,14 +6,19 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
struct ParsedColor {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
let name: String
|
||||
let light: String
|
||||
let dark: String
|
||||
|
||||
// Generate Contents.json content
|
||||
// MARK: - Contents.json
|
||||
|
||||
/// Generate Contents.json content
|
||||
func contentsJSON() -> String {
|
||||
let lightARGB = light.colorComponent()
|
||||
let darkARGB = dark.colorComponent()
|
||||
@ -73,20 +78,24 @@ struct ParsedColor {
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - UIKit
|
||||
// MARK: - Property
|
||||
|
||||
func getColorProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||
func getColorProperty(
|
||||
isStatic: Bool,
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
if isSwiftUI {
|
||||
return """
|
||||
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
||||
\(isStatic ? "static " : "")var \(name): Color {
|
||||
\(visibility) \(isStatic ? "static " : "")var \(name): Color {
|
||||
Color("\(name)")
|
||||
}
|
||||
"""
|
||||
}
|
||||
return """
|
||||
/// Color \(name) is \(light) (light) or \(dark) (dark)"
|
||||
\(isStatic ? "static " : "@objc ")var \(name): UIColor {
|
||||
\(isStatic ? "" : "@objc ")\(visibility) \(isStatic ? "static " : "")var \(name): UIColor {
|
||||
UIColor(named: "\(name)")!
|
||||
}
|
||||
"""
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
@ -21,6 +22,13 @@ struct FontsOptions: ParsableArguments {
|
||||
@Option(help: "Tell if it will generate static properties or methods")
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
var extensionOutputPath: String
|
||||
|
||||
|
@ -57,7 +57,8 @@ struct Fonts: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
isSwiftUI: true
|
||||
isSwiftUI: true,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
|
||||
if let extensionNameUIKit = options.extensionNameUIKit,
|
||||
@ -67,7 +68,8 @@ struct Fonts: ParsableCommand {
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: extensionNameUIKit,
|
||||
extensionFilePath: extensionFilePathUIKit,
|
||||
isSwiftUI: false
|
||||
isSwiftUI: false,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,11 @@ import ToolCore
|
||||
|
||||
enum FontExtensionGenerator {
|
||||
|
||||
private static func getFontNameEnum(fontsNames: [FontName]) -> String {
|
||||
var enumDefinition = " enum FontName: String {\n"
|
||||
private static func getFontNameEnum(
|
||||
fontsNames: [FontName],
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
var enumDefinition = " \(visibility) enum FontName: String {\n"
|
||||
|
||||
fontsNames.forEach {
|
||||
enumDefinition += " case \($0.fontNameSanitize) = \"\($0.postscriptName)\"\n"
|
||||
@ -26,14 +29,16 @@ enum FontExtensionGenerator {
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
extensionFilePath: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Create extension content
|
||||
let extensionContent = Self.getExtensionContent(
|
||||
fontsNames: fontsNames,
|
||||
staticVar: staticVar,
|
||||
extensionName: extensionName,
|
||||
isSwiftUI: isSwiftUI
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
@ -51,18 +56,33 @@ enum FontExtensionGenerator {
|
||||
fontsNames: [FontName],
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
Self.getHeader(extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||
Self.getFontNameEnum(fontsNames: fontsNames),
|
||||
Self.getFontMethods(fontsNames: fontsNames, staticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||
Self.getHeader(
|
||||
extensionClassname: extensionName,
|
||||
isSwiftUI: isSwiftUI
|
||||
),
|
||||
Self.getFontNameEnum(
|
||||
fontsNames: fontsNames,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFontMethods(
|
||||
fontsNames: fontsNames,
|
||||
staticVar: staticVar,
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFooter()
|
||||
]
|
||||
.joined(separator: "\n")
|
||||
}
|
||||
|
||||
private static func getHeader(extensionClassname: String, isSwiftUI: Bool) -> String {
|
||||
private static func getHeader(
|
||||
extensionClassname: String,
|
||||
isSwiftUI: Bool
|
||||
) -> String {
|
||||
"""
|
||||
// Generated by ResgenSwift.\(Fonts.toolName) \(ResgenSwiftVersion)
|
||||
|
||||
@ -72,13 +92,22 @@ enum FontExtensionGenerator {
|
||||
"""
|
||||
}
|
||||
|
||||
private static func getFontMethods(fontsNames: [FontName], staticVar: Bool, isSwiftUI: Bool) -> String {
|
||||
private static func getFontMethods(
|
||||
fontsNames: [FontName],
|
||||
staticVar: Bool,
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
let pragma = " // MARK: - Getter"
|
||||
|
||||
var propertiesOrMethods: [String] = fontsNames
|
||||
.unique()
|
||||
.map {
|
||||
$0.getProperty(isStatic: staticVar, isSwiftUI: isSwiftUI)
|
||||
$0.getProperty(
|
||||
isStatic: staticVar,
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
)
|
||||
}
|
||||
|
||||
propertiesOrMethods.insert(pragma, at: 0)
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
@ -22,33 +23,40 @@ extension FontName {
|
||||
postscriptName.removeCharacters(from: "[]+-_")
|
||||
}
|
||||
|
||||
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 {
|
||||
func getProperty(
|
||||
isStatic: Bool,
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
switch (isSwiftUI, isStatic) {
|
||||
case (true, true):
|
||||
// SwiftUI, Static => let
|
||||
"""
|
||||
\(visibility) static let \(fontNameSanitize): ((_ size: CGFloat) -> Font) = { size in
|
||||
Font.custom(FontName.\(fontNameSanitize).rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
}
|
||||
// UIKit
|
||||
if isStatic {
|
||||
return """
|
||||
static let \(fontNameSanitize): ((_ size: CGFloat) -> UIFont) = { size in
|
||||
case (true, false):
|
||||
// SwiftUI, Not Static => func
|
||||
"""
|
||||
\(visibility) func \(fontNameSanitize)(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.\(fontNameSanitize).rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
case (false, true):
|
||||
// UIKit, Static => let
|
||||
"""
|
||||
\(visibility) static let \(fontNameSanitize): ((_ size: CGFloat) -> UIFont) = { size in
|
||||
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
}
|
||||
return """
|
||||
func \(fontNameSanitize)(withSize size: CGFloat) -> UIFont {
|
||||
case (false, false):
|
||||
// UIKit, Not Static => func
|
||||
"""
|
||||
\(visibility) func \(fontNameSanitize)(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.\(fontNameSanitize).rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,31 +86,21 @@ struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let target: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let outputFile: String
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
target: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
outputFile: String,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.target = target
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.outputFile = outputFile
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -119,9 +109,9 @@ struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
Analytics configuration:
|
||||
- Input file: \(inputFile)
|
||||
- Target: \(target)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Output file: \(outputFile)
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -135,14 +125,8 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -152,6 +136,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -161,6 +146,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -174,6 +160,8 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -186,14 +174,8 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
let infoPlistPaths: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -202,6 +184,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
infoPlistPaths: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -210,6 +193,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.infoPlistPaths = infoPlistPaths
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -222,6 +206,8 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- InfoPlistPaths: \(infoPlistPaths ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -234,14 +220,8 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -250,6 +230,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -258,6 +239,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -270,6 +252,8 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -283,22 +267,9 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
private let xcStrings: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var xcStringsOptions: Bool {
|
||||
if let xcStrings {
|
||||
return xcStrings
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
let xcStrings: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -308,6 +279,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?,
|
||||
xcStrings: Bool?
|
||||
) {
|
||||
@ -318,6 +290,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
self.xcStrings = xcStrings
|
||||
}
|
||||
@ -332,6 +305,9 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
- XC Strings: \(xcStrings != nil ? "\(String(describing: xcStrings))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -343,14 +319,8 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -358,6 +328,7 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -365,6 +336,7 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -376,6 +348,8 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension AnalyticsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Analytics.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -20,25 +25,23 @@ extension AnalyticsConfiguration: Runnable {
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--target",
|
||||
target,
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
"--output-file",
|
||||
outputFile.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
// Add optional parameters
|
||||
[
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,7 @@ extension ColorsConfiguration: Runnable {
|
||||
"--style",
|
||||
style,
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -36,7 +34,9 @@ extension ColorsConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -22,9 +22,7 @@ extension FontsConfiguration: Runnable {
|
||||
}
|
||||
|
||||
args += [
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
inputFile.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -32,7 +30,9 @@ extension FontsConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -24,9 +24,7 @@ extension ImagesConfiguration: Runnable {
|
||||
args += [
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -34,7 +32,9 @@ extension ImagesConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension StringsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Stringium.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -23,18 +28,17 @@ extension StringsConfiguration: Runnable {
|
||||
"--langs",
|
||||
langs,
|
||||
"--default-lang",
|
||||
defaultLang,
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)",
|
||||
"--xc-strings",
|
||||
"\(xcStringsOptions)"
|
||||
defaultLang
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--xc-strings", staticMembers?.description),
|
||||
("--static-members", xcStrings?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
@ -44,6 +48,6 @@ extension StringsConfiguration: Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
Stringium.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension TagsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Tags.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -21,24 +26,24 @@ extension TagsConfiguration: Runnable {
|
||||
"--lang",
|
||||
lang,
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-name", extensionName),
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Tags.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ enum ImageExtensionGenerator {
|
||||
inputFilename: String,
|
||||
extensionName: String,
|
||||
extensionFilePath: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Create extension conten1t
|
||||
let extensionContent = Self.getExtensionContent(
|
||||
@ -26,7 +27,8 @@ enum ImageExtensionGenerator {
|
||||
staticVar: staticVar,
|
||||
extensionName: extensionName,
|
||||
inputFilename: inputFilename,
|
||||
isSwiftUI: isSwiftUI
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
@ -45,11 +47,21 @@ enum ImageExtensionGenerator {
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
inputFilename: String,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
Self.getHeader(inputFilename: inputFilename, extensionClassname: extensionName, isSwiftUI: isSwiftUI),
|
||||
Self.getProperties(images: images, staticVar: staticVar, isSwiftUI: isSwiftUI),
|
||||
Self.getHeader(
|
||||
inputFilename: inputFilename,
|
||||
extensionClassname: extensionName,
|
||||
isSwiftUI: isSwiftUI
|
||||
),
|
||||
Self.getProperties(
|
||||
images: images,
|
||||
staticVar: staticVar,
|
||||
isSwiftUI: isSwiftUI,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFooter()
|
||||
]
|
||||
.joined(separator: "\n")
|
||||
@ -73,10 +85,13 @@ enum ImageExtensionGenerator {
|
||||
private static func getProperties(
|
||||
images: [ParsedImage],
|
||||
staticVar: Bool,
|
||||
isSwiftUI: Bool
|
||||
isSwiftUI: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
images
|
||||
.map { "\n\($0.getImageProperty(isStatic: staticVar, isSwiftUI: isSwiftUI))" }
|
||||
.map {
|
||||
"\n\($0.getImageProperty(isStatic: staticVar, isSwiftUI: isSwiftUI, visibility: visibility))"
|
||||
}
|
||||
.joined(separator: "\n")
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,8 @@ struct Images: ParsableCommand {
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: extensionName,
|
||||
extensionFilePath: extensionFilePath,
|
||||
isSwiftUI: true
|
||||
isSwiftUI: true,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
@ -73,7 +74,8 @@ struct Images: ParsableCommand {
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: extensionNameUIKit,
|
||||
extensionFilePath: extensionFilePathUIKit,
|
||||
isSwiftUI: false
|
||||
isSwiftUI: false,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -7,27 +7,54 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
struct ImagesOptions: ParsableArguments {
|
||||
|
||||
@Flag(name: .customShort("f"), help: "Should force script execution")
|
||||
@Flag(
|
||||
name: .customShort("f"),
|
||||
help: "Should force script execution"
|
||||
)
|
||||
var forceExecution = false
|
||||
|
||||
@Flag(name: .customShort("F"), help: "Regenerate all images")
|
||||
@Flag(
|
||||
name: .customShort("F"),
|
||||
help: "Regenerate all images"
|
||||
)
|
||||
var forceExecutionAndGeneration = false
|
||||
|
||||
@Argument(help: "Input files where strings ared defined.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Argument(
|
||||
help: "Input files where strings ared defined.",
|
||||
completion: .file(),
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var inputFile: String
|
||||
|
||||
@Option(help: "Xcassets path where to generate images.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
help: "Xcassets path where to generate images.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var xcassetsPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
@Option(
|
||||
help: "Tell if it will generate static properties or not",
|
||||
completion: .list(["true", "false"])
|
||||
)
|
||||
var staticMembers: Bool = false
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
|
||||
@Option(
|
||||
help: "Path where to generate the extension.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var extensionOutputPath: String?
|
||||
|
||||
@Option(help: "SwiftUI extension name. If not specified, no extension will be generated.")
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
enum ImageExtension: String {
|
||||
|
||||
@ -129,16 +130,16 @@ struct ParsedImage {
|
||||
|
||||
// MARK: - Extension property
|
||||
|
||||
func getImageProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||
func getImageProperty(isStatic: Bool, isSwiftUI: Bool, visibility: ExtensionVisibility) -> String {
|
||||
if isSwiftUI {
|
||||
return """
|
||||
\(isStatic ? "static " : "")var \(name): Image {
|
||||
\(visibility) \(isStatic ? "static " : "")var \(name): Image {
|
||||
Image("\(name)")
|
||||
}
|
||||
"""
|
||||
}
|
||||
return """
|
||||
\(isStatic ? "static " : "")var \(name): UIImage {
|
||||
\(visibility) \(isStatic ? "static " : "")var \(name): UIImage {
|
||||
UIImage(named: "\(name)")!
|
||||
}
|
||||
"""
|
||||
|
@ -251,7 +251,8 @@ enum StringsFileGenerator {
|
||||
inputFilename: String,
|
||||
extensionName: String,
|
||||
extensionFilePath: String,
|
||||
extensionSuffix: String
|
||||
extensionSuffix: String,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Get extension content
|
||||
let extensionFileContent = Self.getExtensionContent(
|
||||
@ -261,7 +262,8 @@ enum StringsFileGenerator {
|
||||
staticVar: staticVar,
|
||||
inputFilename: inputFilename,
|
||||
extensionName: extensionName,
|
||||
extensionSuffix: extensionSuffix
|
||||
extensionSuffix: extensionSuffix,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
@ -284,7 +286,8 @@ enum StringsFileGenerator {
|
||||
staticVar: Bool,
|
||||
inputFilename: String,
|
||||
extensionName: String,
|
||||
extensionSuffix: String
|
||||
extensionSuffix: String,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
Self.getHeader(
|
||||
@ -295,13 +298,15 @@ enum StringsFileGenerator {
|
||||
sections: sections,
|
||||
tags: tags,
|
||||
extensionClassname: extensionName,
|
||||
extensionSuffix: extensionSuffix
|
||||
extensionSuffix: extensionSuffix,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getProperties(
|
||||
sections: sections,
|
||||
defaultLang: lang,
|
||||
tags: tags,
|
||||
staticVar: staticVar
|
||||
staticVar: staticVar,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFooter()
|
||||
]
|
||||
@ -326,9 +331,10 @@ enum StringsFileGenerator {
|
||||
sections: [Section],
|
||||
tags: [String],
|
||||
extensionClassname: String,
|
||||
extensionSuffix: String
|
||||
extensionSuffix: String,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
var enumDefinition = "\n enum Key\(extensionSuffix.uppercasedFirst()): String {\n"
|
||||
var enumDefinition = "\n \(visibility) enum Key\(extensionSuffix.uppercasedFirst()): String {\n"
|
||||
|
||||
// Enum
|
||||
sections.forEach { section in
|
||||
@ -347,7 +353,7 @@ enum StringsFileGenerator {
|
||||
|
||||
// KeyPath accessors
|
||||
enumDefinition += "\n"
|
||||
enumDefinition += " var keyPath: KeyPath<\(extensionClassname), String> {\n"
|
||||
enumDefinition += " \(visibility) var keyPath: KeyPath<\(extensionClassname), String> {\n"
|
||||
enumDefinition += " switch self {\n"
|
||||
sections.forEach { section in
|
||||
// Check that at least one string will be generated
|
||||
@ -369,7 +375,13 @@ enum StringsFileGenerator {
|
||||
return enumDefinition
|
||||
}
|
||||
|
||||
private static func getProperties(sections: [Section], defaultLang lang: String, tags: [String], staticVar: Bool) -> String {
|
||||
private static func getProperties(
|
||||
sections: [Section],
|
||||
defaultLang lang: String,
|
||||
tags: [String],
|
||||
staticVar: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
sections.compactMap { section in
|
||||
// Check that at least one string will be generated
|
||||
guard section.hasOneOrMoreMatchingTags(tags: tags) else {
|
||||
@ -382,10 +394,21 @@ enum StringsFileGenerator {
|
||||
return nil // Go to next definition
|
||||
}
|
||||
|
||||
if staticVar {
|
||||
return "\n\(definition.getNSLocalizedStringStaticProperty(forLang: lang))"
|
||||
}
|
||||
return "\n\(definition.getNSLocalizedStringProperty(forLang: lang))"
|
||||
let property: String = {
|
||||
if staticVar {
|
||||
definition.getNSLocalizedStringStaticProperty(
|
||||
forLang: lang,
|
||||
visibility: visibility
|
||||
)
|
||||
} else {
|
||||
definition.getNSLocalizedStringProperty(
|
||||
forLang: lang,
|
||||
visibility: visibility
|
||||
)
|
||||
}
|
||||
}()
|
||||
|
||||
return "\n\(property)"
|
||||
}
|
||||
.joined(separator: "\n")
|
||||
return res
|
||||
|
@ -17,7 +17,8 @@ enum TagsGenerator {
|
||||
tags: [String],
|
||||
staticVar: Bool,
|
||||
extensionName: String,
|
||||
extensionFilePath: String
|
||||
extensionFilePath: String,
|
||||
visibility: ExtensionVisibility
|
||||
) {
|
||||
// Get extension content
|
||||
let extensionFileContent = Self.getExtensionContent(
|
||||
@ -25,7 +26,8 @@ enum TagsGenerator {
|
||||
lang: lang,
|
||||
tags: tags,
|
||||
staticVar: staticVar,
|
||||
extensionName: extensionName
|
||||
extensionName: extensionName,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Write content
|
||||
@ -46,7 +48,8 @@ enum TagsGenerator {
|
||||
lang: String,
|
||||
tags: [String],
|
||||
staticVar: Bool,
|
||||
extensionName: String
|
||||
extensionName: String,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
[
|
||||
Self.getHeader(
|
||||
@ -57,7 +60,8 @@ enum TagsGenerator {
|
||||
sections: sections,
|
||||
lang: lang,
|
||||
tags: tags,
|
||||
staticVar: staticVar
|
||||
staticVar: staticVar,
|
||||
visibility: visibility
|
||||
),
|
||||
Self.getFooter()
|
||||
]
|
||||
@ -80,7 +84,8 @@ enum TagsGenerator {
|
||||
sections: [Section],
|
||||
lang: String,
|
||||
tags: [String],
|
||||
staticVar: Bool
|
||||
staticVar: Bool,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
sections
|
||||
.compactMap { section in
|
||||
@ -96,9 +101,9 @@ enum TagsGenerator {
|
||||
}
|
||||
|
||||
if staticVar {
|
||||
res += "\n\n\(definition.getStaticProperty(forLang: lang))"
|
||||
res += "\n\n\(definition.getStaticProperty(forLang: lang, visibility: visibility))"
|
||||
} else {
|
||||
res += "\n\n\(definition.getProperty(forLang: lang))"
|
||||
res += "\n\n\(definition.getProperty(forLang: lang, visibility: visibility))"
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable force_unwrapping
|
||||
|
||||
@ -99,14 +100,20 @@ class Definition {
|
||||
return (inputParameters: inputParameters, translationArguments: translationArguments)
|
||||
}
|
||||
|
||||
private func getBaseProperty(lang: String, translation: String, isStatic: Bool, comment: String?) -> String {
|
||||
private func getBaseProperty(
|
||||
lang: String,
|
||||
translation: String,
|
||||
isStatic: Bool,
|
||||
comment: String?,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
"""
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
///
|
||||
/// Comment :
|
||||
/// \(comment?.isEmpty == false ? comment! : "No comment")
|
||||
\(isStatic ? "static " : "")var \(name): String {
|
||||
\(visibility) \(isStatic ? "static " : "")var \(name): String {
|
||||
NSLocalizedString("\(name)", tableName: kStringsFileName, bundle: Bundle.main, value: "\(translation)", comment: "\(comment ?? "")")
|
||||
}
|
||||
"""
|
||||
@ -118,7 +125,8 @@ class Definition {
|
||||
isStatic: Bool,
|
||||
inputParameters: [String],
|
||||
translationArguments: [String],
|
||||
comment: String?
|
||||
comment: String?,
|
||||
visibility: ExtensionVisibility
|
||||
) -> String {
|
||||
"""
|
||||
|
||||
@ -127,13 +135,13 @@ class Definition {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(comment?.isEmpty == false ? comment! : "No comment")
|
||||
\(isStatic ? "static " : "")func \(name)(\(inputParameters.joined(separator: ", "))) -> String {
|
||||
\(visibility) \(isStatic ? "static " : "")func \(name)(\(inputParameters.joined(separator: ", "))) -> String {
|
||||
String(format: \(isStatic ? "Self" : "self").\(name), \(translationArguments.joined(separator: ", ")))
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
func getNSLocalizedStringProperty(forLang lang: String) -> String {
|
||||
func getNSLocalizedStringProperty(forLang lang: String, visibility: ExtensionVisibility) -> String {
|
||||
guard let translation = translations[lang] else {
|
||||
let error = StringiumError.langNotDefined(lang, name, reference != nil)
|
||||
print(error.description)
|
||||
@ -145,7 +153,8 @@ class Definition {
|
||||
lang: lang,
|
||||
translation: translation,
|
||||
isStatic: false,
|
||||
comment: self.comment
|
||||
comment: self.comment,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Generate method
|
||||
@ -157,14 +166,15 @@ class Definition {
|
||||
isStatic: false,
|
||||
inputParameters: parameters.inputParameters,
|
||||
translationArguments: parameters.translationArguments,
|
||||
comment: self.comment
|
||||
comment: self.comment,
|
||||
visibility: visibility
|
||||
)
|
||||
}
|
||||
|
||||
return property + method
|
||||
}
|
||||
|
||||
func getNSLocalizedStringStaticProperty(forLang lang: String) -> String {
|
||||
func getNSLocalizedStringStaticProperty(forLang lang: String, visibility: ExtensionVisibility) -> String {
|
||||
guard let translation = translations[lang] else {
|
||||
let error = StringiumError.langNotDefined(lang, name, reference != nil)
|
||||
print(error.description)
|
||||
@ -176,7 +186,8 @@ class Definition {
|
||||
lang: lang,
|
||||
translation: translation,
|
||||
isStatic: true,
|
||||
comment: self.comment
|
||||
comment: self.comment,
|
||||
visibility: visibility
|
||||
)
|
||||
|
||||
// Generate method
|
||||
@ -188,7 +199,8 @@ class Definition {
|
||||
isStatic: true,
|
||||
inputParameters: parameters.inputParameters,
|
||||
translationArguments: parameters.translationArguments,
|
||||
comment: self.comment
|
||||
comment: self.comment,
|
||||
visibility: visibility
|
||||
)
|
||||
}
|
||||
|
||||
@ -197,7 +209,7 @@ class Definition {
|
||||
|
||||
// MARK: - Raw strings
|
||||
|
||||
func getProperty(forLang lang: String) -> String {
|
||||
func getProperty(forLang lang: String, visibility: ExtensionVisibility) -> String {
|
||||
guard let translation = translations[lang] else {
|
||||
let error = StringiumError.langNotDefined(lang, name, reference != nil)
|
||||
print(error.description)
|
||||
@ -210,14 +222,13 @@ class Definition {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(comment?.isEmpty == false ? comment! : "No comment")
|
||||
|
||||
var \(name): String {
|
||||
\(visibility) var \(name): String {
|
||||
"\(translation)"
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
func getStaticProperty(forLang lang: String) -> String {
|
||||
func getStaticProperty(forLang lang: String, visibility: ExtensionVisibility) -> String {
|
||||
guard let translation = translations[lang] else {
|
||||
let error = StringiumError.langNotDefined(lang, name, reference != nil)
|
||||
print(error.description)
|
||||
@ -230,7 +241,7 @@ class Definition {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(comment?.isEmpty == false ? comment! : "No comment")
|
||||
static var \(name): String {
|
||||
\(visibility) static var \(name): String {
|
||||
"\(translation)"
|
||||
}
|
||||
"""
|
||||
|
@ -72,7 +72,8 @@ struct Stringium: ParsableCommand {
|
||||
inputFilename: options.inputFilenameWithoutExt,
|
||||
extensionName: extensionName,
|
||||
extensionFilePath: extensionFilePath,
|
||||
extensionSuffix: options.extensionSuffix ?? ""
|
||||
extensionSuffix: options.extensionSuffix ?? "",
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
@ -23,7 +24,7 @@ struct StringiumOptions: ParsableArguments {
|
||||
|
||||
@Option(
|
||||
name: .customLong("output-path"),
|
||||
help: "Path where to strings file.",
|
||||
help: "Path where to find the .xcStrings file or the lproj folders.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
fileprivate var outputPathRaw: String
|
||||
@ -49,6 +50,13 @@ struct StringiumOptions: ParsableArguments {
|
||||
@Option(help: "Tell if it will generate xcStrings file or lproj file. True by default")
|
||||
var xcStrings: Bool = true
|
||||
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
|
||||
@Option(
|
||||
help: "Path where to generate the extension.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
|
@ -49,7 +49,8 @@ struct Tags: ParsableCommand {
|
||||
tags: ["ios", "iosonly", Self.noTranslationTag],
|
||||
staticVar: options.staticMembers,
|
||||
extensionName: options.extensionName,
|
||||
extensionFilePath: options.extensionFilePath
|
||||
extensionFilePath: options.extensionFilePath,
|
||||
visibility: options.extensionVisibility
|
||||
)
|
||||
|
||||
print("[\(Self.toolName)] Tags generated")
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
// swiftlint:disable no_grouping_extension
|
||||
|
||||
@ -21,7 +22,17 @@ struct TagsOptions: ParsableArguments {
|
||||
@Option(help: "Lang to generate. (\"ium\" by default)")
|
||||
var lang: String = "ium"
|
||||
|
||||
@Option(help: "Path where to generate the extension.", transform: { $0.replaceTiltWithHomeDirectoryPath() })
|
||||
@Option(
|
||||
name: .customLong("visibility"),
|
||||
help: "Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal",
|
||||
completion: .list(["public", "private", "package", "internal"])
|
||||
)
|
||||
var extensionVisibility: ExtensionVisibility = .internal
|
||||
|
||||
@Option(
|
||||
help: "Path where to generate the extension.",
|
||||
transform: { $0.replaceTiltWithHomeDirectoryPath() }
|
||||
)
|
||||
var extensionOutputPath: String
|
||||
|
||||
@Option(help: "Tell if it will generate static properties or not")
|
||||
|
31
Sources/ToolCore/ExtensionVisibility.swift
Normal file
31
Sources/ToolCore/ExtensionVisibility.swift
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// ExtensionVisibility.swift
|
||||
// ResgenSwift
|
||||
//
|
||||
// Created by Thibaut Schmitt on 17/07/2025.
|
||||
//
|
||||
|
||||
import ArgumentParser
|
||||
|
||||
package enum ExtensionVisibility: String, CustomStringConvertible, ExpressibleByArgument {
|
||||
|
||||
case `public`
|
||||
case `private`
|
||||
case `internal`
|
||||
case `package`
|
||||
|
||||
// MARK: - CustomStringConvertible
|
||||
|
||||
package var description: String {
|
||||
switch self {
|
||||
case .public:
|
||||
"public"
|
||||
case .private:
|
||||
"private"
|
||||
case .internal:
|
||||
"internal"
|
||||
case .package:
|
||||
"package"
|
||||
}
|
||||
}
|
||||
}
|
@ -9,4 +9,4 @@ import Foundation
|
||||
|
||||
// swiftlint:disable prefixed_toplevel_constant identifier_name
|
||||
|
||||
public let ResgenSwiftVersion = "2.2g.0"
|
||||
public let ResgenSwiftVersion = "2.2.0"
|
||||
|
Reference in New Issue
Block a user