Skip to content
Snippets Groups Projects
Select Git revision
  • f01aa47c42a205b7dfa6e315ed0a73c0b13b286a
  • main default protected
  • development
  • integration
  • v1.1.5
  • v1.1.4
  • v1.1.3
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.0
11 results

CmixNetworkFollowerStatus.swift

Blame
  • NDFDownloader.swift 785 B
    import Bindings
    
    public struct NDFDownloader {
      public var run: (Environment) throws -> Data
    
      public func callAsFunction(_ env: Environment) throws -> Data {
        try run(env)
      }
    }
    
    extension NDFDownloader {
      public static let live = NDFDownloader { env in
        var error: NSError?
        let data = BindingsDownloadAndVerifySignedNdfWithUrl(
          env.url.absoluteString,
          env.cert,
          &error
        )
        if let error = error {
          throw error
        }
        guard let data = data else {
          fatalError("BindingsDownloadAndVerifySignedNdfWithUrl returned `nil` without providing error")
        }
        return data
      }
    }
    
    #if DEBUG
    extension NDFDownloader {
      public static let failing = NDFDownloader { _ in
        struct NotImplemented: Error {}
        throw NotImplemented()
      }
    }
    #endif