mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-07 04:48:34 +00:00
27 lines
630 B
Swift
27 lines
630 B
Swift
//
|
|
// MediaProviderProtocol.swift
|
|
// ElementX
|
|
//
|
|
// Created by Stefan Ceriu on 17/03/2022.
|
|
// Copyright © 2022 Element. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
enum MediaProviderError: Error {
|
|
case failedRetrievingImage
|
|
case invalidImageData
|
|
}
|
|
|
|
@MainActor
|
|
protocol MediaProviderProtocol {
|
|
func imageFromSource(_ source: MediaSource?) -> UIImage?
|
|
|
|
func loadImageFromSource(_ source: MediaSource) async -> Result<UIImage, MediaProviderError>
|
|
|
|
func imageFromURL(_ url: String?) -> UIImage?
|
|
|
|
func loadImageFromURL(_ url: String) async -> Result<UIImage, MediaProviderError>
|
|
}
|