ImageViewModel
final class ImageViewModel
The observable state for an image in a ChordPro song
-
The
NSImageDeclaration
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?) asyncParameters
argumentsThe new
Arguments -
Load an image from the cache if found or else from an URL
Declaration
Swift
private func loadImage(url: URL?) asyncParameters
urlThe URL of the image
-
Load an image from an URL
Declaration
Swift
private func loadImageFromURL(url: URL) asyncParameters
urlThe URL of the image
-
Create a fallback image
Declaration
Swift
private func fallbackImage(url: URL)Parameters
urlThe URL of the original image
View on GitHub