Skip to content

Commit

Permalink
Merge branch 'feature/oguzhnatly#20-imageurl' into combine-all
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Sep 20, 2022
2 parents ee91108 + fcf339c commit a182231
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ios/Classes/FCPExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ extension UIImage {
func fromCorrectSource(name: String) -> UIImage {
if (name.starts(with: "http")) {
return fromUrl(url: name)
} else if (name.starts(with: "//")) {
return fromFile(path: name)
}
return fromFlutterAsset(name: name)
}
Expand All @@ -26,7 +28,13 @@ extension UIImage {
let image: UIImage? = UIImage(imageLiteralResourceName: key!)
return image ?? UIImage(systemName: "questionmark")!
}


@available(iOS 14.0, *)
func fromFile(path: String) -> UIImage {
let image: UIImage? = UIImage(contentsOfFile: path)
return image ?? UIImage(systemName: "questionmark")!
}

@available(iOS 14.0, *)
func fromUrl(url: String) -> UIImage {
let url = URL(string: url)
Expand Down

0 comments on commit a182231

Please sign in to comment.