mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 13:50:32 +05:30
33 lines
625 B
Swift
33 lines
625 B
Swift
import Foundation
|
|
import SwiftyJSON
|
|
|
|
class SettingsGroupExporter { // swiftlint:disable:this final_class
|
|
var globalJSON: JSON {
|
|
[]
|
|
}
|
|
|
|
var platformJSON: JSON {
|
|
[]
|
|
}
|
|
|
|
var exportJSON: JSON {
|
|
var json = globalJSON
|
|
|
|
if !platformJSON.isEmpty {
|
|
try? json.merge(with: platformJSON)
|
|
}
|
|
|
|
return json
|
|
}
|
|
|
|
func jsonFromString(_ string: String?) -> JSON? {
|
|
if let data = string?.data(using: .utf8, allowLossyConversion: false),
|
|
let json = try? JSON(data: data)
|
|
{
|
|
return json
|
|
}
|
|
|
|
return nil
|
|
}
|
|
}
|