Skip to content
Snippets Groups Projects
Select Git revision
  • 817d15c149b10ea2e5f05bf977993d424b48e8ac
  • main default protected
  • dev protected
  • hotfixes-oct-2022
  • refactor/avatar-cell
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1
  • 1.0.8
  • 1.0.7
  • 1.0.6
12 results

run_swiftgen.sh

Blame
  • Progress.swift 774 B
    import Foundation
    
    public struct Progress: Equatable {
      public init(
        completed: Bool,
        transmitted: Int,
        total: Int,
        error: String?
      ) {
        self.completed = completed
        self.transmitted = transmitted
        self.total = total
        self.error = error
      }
    
      public var completed: Bool
      public var transmitted: Int
      public var total: Int
      public var error: String?
    }
    
    extension Progress: Codable {
      enum CodingKeys: String, CodingKey {
        case completed = "Completed"
        case transmitted = "Transmitted"
        case total = "Total"
        case error = "Err"
      }
    
      public static func decode(_ data: Data) throws -> Self {
        try JSONDecoder().decode(Self.self, from: data)
      }
    
      public func encode() throws -> Data {
        try JSONEncoder().encode(self)
      }
    }