mono / SkiaSharp.Extended

SkiaSharp is a cross-platform, comprehensive 2D graphics API for all .NET platforms. And, here is where you will find all sorts of extras that you can use with it.
https://mono.github.io/SkiaSharp.Extended
MIT License
218 stars 69 forks source link

[QUESTION] Integrating SKLottieView into a UIViewController? #263

Closed ValonK closed 3 months ago

ValonK commented 3 months ago

Hello,

I'm currently working on integrating Lottie animations into my iOS application using SKLottieView. However, I'm facing some challenges in properly displaying the SKLottieView within a UIViewController/UIView. I am looking for guidance on how to use SKLottieView in the context of a UIViewController.

Before I dive into creating my own bindings for Lottie.iOS, I thought about giving SKLottieView a try. However, it's not as straightforward as I had hoped, especially since SKLottieView isn't exactly a drop-in replacement for UIView.

Has anybody tried this so far?

[Register("SplashController")]
public partial class SplashController : UIViewController
{
    private SKLottieView _skLottieView;

    public SplashController() : base("SplashController", null)
    {
    }

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        _skLottieView = new SKLottieView();
        _skLottieView.Source = new SKFileLottieImageSource()
        {
            File = "splash_animation_ios.json"
        };

        View?.AddSubview(); // SKLottieView should be added here
    }
}