mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-03-01 00:35:19 +08:00
fix: spm
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// ClashRule.swift
|
||||
// ClashX
|
||||
//
|
||||
// Created by CYC on 2018/10/27.
|
||||
// Copyright © 2018 west2online. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
class ClashRule: NSObject, Codable, Identifiable {
|
||||
@objc let type: String
|
||||
@objc let payload: String?
|
||||
@objc let proxy: String?
|
||||
|
||||
init(type: String, payload: String?, proxy: String?) {
|
||||
self.type = type
|
||||
self.payload = payload
|
||||
self.proxy = proxy
|
||||
}
|
||||
}
|
||||
|
||||
class ClashRuleResponse: Codable {
|
||||
var rules: [ClashRule]?
|
||||
|
||||
static func empty() -> ClashRuleResponse {
|
||||
return ClashRuleResponse()
|
||||
}
|
||||
|
||||
static func fromData(_ data: Data) -> ClashRuleResponse {
|
||||
let decoder = JSONDecoder()
|
||||
let model = try? decoder.decode(ClashRuleResponse.self, from: data)
|
||||
return model ?? ClashRuleResponse.empty()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user