This demo app demonstrates how to use the MediaView
from the custom Media Framework to display various types of media, including images, videos, GIFs, and Lottie animations. It provides a SwiftUI-based interface with sections for each media type.
- Image Support
- Local images.
- Remote images via URL.
- Video Support
- Local videos.
- Remote videos via URL.
- GIF Support
- Remote GIFs via URL.
- Lottie Animation Support
- Local Lottie animations.
- iOS 15.0 or later.
- Swift 5.5 or later.
- Clone the repository containing this demo app and the Media Framework.
- Integrate the Media Framework into your project using your preferred method (SPM, CocoaPods, etc.).
MediaView
is the core view component used to display different types of media. It requires a mediaType
parameter to specify the type of media being displayed.
- Local Images
MediaView( mediaType: .image(.name("pizza", nil)) )
- Remote Images
MediaView( mediaType: .image( .remote(URL(string: "https://fastly.picsum.photos/id/237/200/300.jpg?hmac=TmmQSbShHz9CdQm0NkEjx1Dyh_Y984R9LpNrpvH2D_U")!) ) )
- Remote Videos
MediaView( mediaType: .video( .remote(URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!) ) ) .frame(height: 400)
- Local Videos
MediaView( mediaType: .video(.name("ForBiggerBlazes", .main)) ) .frame(height: 400)
- Remote GIFs
MediaView( mediaType: .gif( .remote(URL(string: "https://media1.tenor.com/m/Ps_NnXFTyRYAAAAd/send-link-send.gif")!) ) )
- Local Lottie Files
MediaView(mediaType: .lottie(.name("lottie-sample", nil))) .frame(height: 400)
Screen.Recording.2024-12-24.at.11.09.41.AM.mp4
- Ensure all resources (images, videos, Lottie files) are added to your project or accessible via the provided URLs.
- This app is a demonstration and should be adapted as needed for production use.
This project is available under the MIT License.