Skip to content

Commit 2be6974

Browse files
committed
CM-965: Protocol 'ImageAsset' Added
1 parent ce936b5 commit 2be6974

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Sources/YCoreUI/Protocols/ImageAsset.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,27 @@
55
// Created by Dev Karan on 19/12/22.
66
// Copyright © 2022 Y Media Labs. All rights reserved.
77
//
8+
9+
import Foundation
10+
import UIKit
11+
12+
public protocol ImageAsset {
13+
/// The bundle containing the localized strings for this enum.
14+
static var bundle: Bundle { get }
15+
16+
/// Optional namespace for the image assets (default is `nil`).
17+
static var namespace: String? { get }
18+
19+
/// Fallback image to use in case an image asset cannot be loaded (default is `.systemPink`)
20+
static var fallbackImage: UIImage { get }
21+
22+
/// An image asset for this name value.
23+
///
24+
/// Default implementation calls `loadImage` and nil-coalesces to `fallbackImage`.
25+
var image: UIImage { get }
26+
27+
/// Loads the image.
28+
///
29+
/// - Returns: The named image or else `nil`,If the named asset cannot be loaded.
30+
func loadImage() -> UIImage?
31+
}

0 commit comments

Comments
 (0)