fix gif caching
This commit is contained in:
1 parent
71b1d0a21d
commit
395cbe5e13
19 files changed
+728
-475
No files matched your search
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Igor Ferreira on 06/04/2022.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum FrameRate {
|
||||
case dynamic
|
||||
case limited(fps: Int)
|
||||
case `static`(fps: Int)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Igor Ferreira on 29/10/2020.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum GIFSource: Equatable {
|
||||
@available(*, deprecated, renamed: "remoteURL(_:)")
|
||||
case remote(url: URL)
|
||||
case remoteURL(_ url: URL)
|
||||
case remoteRequest(_ request: URLRequest)
|
||||
case local(filePath: String)
|
||||
case `static`(data: Data)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Igor Ferreira on 29/10/2020.
|
||||
//
|
||||
|
||||
import ImageIO
|
||||
import Foundation
|
||||
|
||||
public struct ImageFrame {
|
||||
public let image: CGImage
|
||||
public let interval: TimeInterval?
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Igor Ferreira on 05/04/2022.
|
||||
//
|
||||
|
||||
import ImageIO
|
||||
import SwiftUI
|
||||
#if os(macOS)
|
||||
import AppKit
|
||||
public typealias RawImage = NSImage
|
||||
#else
|
||||
import UIKit
|
||||
public typealias RawImage = UIImage
|
||||
#endif
|
||||
|
||||
public extension RawImage {
|
||||
static func create(with cgImage: CGImage) -> RawImage {
|
||||
#if os(macOS)
|
||||
return RawImage(cgImage: cgImage, size: NSSize(width: cgImage.width, height: cgImage.height))
|
||||
#else
|
||||
return RawImage(cgImage: cgImage)
|
||||
#endif
|
||||
}
|
||||
|
||||
static func create(symbol: String) -> RawImage? {
|
||||
#if os(macOS)
|
||||
return RawImage(systemSymbolName: symbol, accessibilityDescription: nil)
|
||||
#else
|
||||
return RawImage(systemName: symbol)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public extension Image {
|
||||
static func loadImage(with image: RawImage) -> Image {
|
||||
#if os(macOS)
|
||||
return Image(nsImage: image)
|
||||
#else
|
||||
return Image(uiImage: image)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user