ImageViewModel
final class ImageViewModel
The observable state for an image in a ChordPro song
-
The
NSImage
Declaration
Swift
var image = NSImage()
-
The size of the image
Declaration
Swift
var size = CGSize(width: 100, height: 80)
-
The arguments of the image from the song source
Declaration
Swift
var arguments: ChordProParser.Arguments?
-
The optional URL of the song file
Declaration
Swift
var fileURL: URL?
-
Init the model
Declaration
Swift
init(arguments: ChordProParser.Arguments?, fileURL: URL?)
-
Update the arguments of the image
Declaration
Swift
func updateArguments(_ arguments: ChordProParser.Arguments?) async
Parameters
arguments
The new
Arguments
-
Load an image from the cache if found or else from an URL
Declaration
Swift
private func loadImage(url: URL?) async
Parameters
url
The URL of the image
-
Load an image from an URL
Declaration
Swift
private func loadImageFromURL(url: URL) async
Parameters
url
The URL of the image
-
Create a fallback image
Declaration
Swift
private func fallbackImage(url: URL)
Parameters
url
The URL of the original image