-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add demo for remote url animation load
- Loading branch information
Miguel Jimenez
committed
Jul 26, 2023
1 parent
e76ed0c
commit d971bac
Showing
5 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Created by miguel_jimenez on 7/25/23. | ||
// Copyright © 2023 Airbnb Inc. All rights reserved. | ||
|
||
import Lottie | ||
import SwiftUI | ||
|
||
// MARK: - AnimationListView | ||
|
||
struct RemoteAnimationsDemoView: View { | ||
|
||
struct Item: Hashable { | ||
let name: String | ||
let url: URL | ||
} | ||
|
||
var body: some View { | ||
NavigationStack { | ||
List { | ||
ForEach(items, id: \.self) { item in | ||
NavigationLink(value: item.url) { | ||
HStack { | ||
LottieView { | ||
await LottieAnimation.loadedFrom(url: item.url) | ||
} | ||
.currentProgress(0.5) | ||
.imageProvider(.exampleAppSampleImages) | ||
.frame(width: 50, height: 50) | ||
.padding(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8)) | ||
|
||
Text(item.name) | ||
} | ||
} | ||
.navigationDestination(for: URL.self) { url in | ||
AnimationPreviewView(animationSource: .remote(url: url)) | ||
} | ||
} | ||
}.navigationTitle("Remote Animations") | ||
} | ||
} | ||
|
||
var items: [Item] { | ||
[ | ||
Item( | ||
name: "Rooms Animation", | ||
url: URL(string: "https://a0.muscache.com/pictures/96699af6-b73e-499f-b0f5-3c862ae7d126.json")!), | ||
] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters