Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from leonardo-ferreira07/dotLottieLoader-local-…
Browse files Browse the repository at this point in the history
…animations

Dot lottie loader local animations
  • Loading branch information
leonardo-ferreira07 authored Oct 18, 2021
2 parents 3cf22e9 + f378791 commit 00ce4d4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Sources/dotLottieLoader/DotLottieCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ public struct DotLottieCreator {
/// - saveUrl: Local file URL to persist
/// - completion: Local URL
private static func download(from url: URL, to saveUrl: URL, completion: @escaping (Bool) -> Void) {
// file is not remote, so just return
/// file is not remote, save the animation content to the proper same URL and return
guard url.isRemoteFile else {
completion(true)
return
let animationData = try? Data(contentsOf: url)
do {
try animationData?.write(to: saveUrl)
completion(true)
return
} catch {
DotLottieUtils.log("Failed to save animation data: \(error.localizedDescription)")
completion(false)
return
}
}

DotLottieUtils.log("Downloading from url: \(url.path)")
Expand Down

0 comments on commit 00ce4d4

Please sign in to comment.