Retours sur la structure du code
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:
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ToolCore
|
||||
|
||||
class AnalyticsDefinition {
|
||||
let id: String
|
||||
@ -18,12 +19,16 @@ class AnalyticsDefinition {
|
||||
var parameters: [AnalyticsParameter] = []
|
||||
var type: TagType
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
init(id: String, name: String, type: TagType) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.type = type
|
||||
}
|
||||
|
||||
// MARK: - Methods
|
||||
|
||||
func hasOneOrMoreMatchingTags(inputTags: [String]) -> Bool {
|
||||
if Set(inputTags).intersection(Set(self.tags)).isEmpty {
|
||||
return false
|
||||
@ -31,8 +36,8 @@ class AnalyticsDefinition {
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - Methods
|
||||
|
||||
// MARK: - Private Methods
|
||||
|
||||
private func getFuncName() -> String {
|
||||
var pascalCaseTitle: String = ""
|
||||
id.components(separatedBy: "_").forEach { word in
|
||||
@ -96,7 +101,7 @@ class AnalyticsDefinition {
|
||||
supplementaryParams.forEach { param in
|
||||
params.append("\"\(param.name)\": \(param.name)")
|
||||
}
|
||||
|
||||
|
||||
if params.count > 1 {
|
||||
result = """
|
||||
[
|
||||
@ -150,27 +155,3 @@ class AnalyticsDefinition {
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
extension AnalyticsDefinition {
|
||||
enum TagType {
|
||||
case screen
|
||||
case event
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
func replacingFirstOccurrence(of: String, with: String) -> Self {
|
||||
if let range = self.range(of: of) {
|
||||
let tmp = self.replacingOccurrences(
|
||||
of: of,
|
||||
with: with,
|
||||
options: .literal,
|
||||
range: range
|
||||
)
|
||||
|
||||
return tmp
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user