Gif en Launched Screen


#1

Hola, Tengo un duda, como puedo incorporar un gif en el Launched Screen ?
Segui un tutorial de Medium , pero Me genera error al cargar el gif.
(https://medium.com/@hukicamer/animated-launch-screen-using-a-gif-in-ios-cd759ae9130d)

¿Alguien tendrá otra forma de hacerlo?
De ante mano, muchas gracias por la ayuda.


#2

Pero qué error te lanza Xcode? Agregalo a tu comentario, porque sólo decir -ah falla. Pues no nos dice mucho.


#3

Como comenta @RHalgravez, podrías enviarnos el error que te envía la consola. Este foro soporta markdown por ejemplo:

//
//  AppDelegate.swift
//  Spacebook
//
//  Created by Supernova.
//  Copyright © 2018 Supernova. All rights reserved.
//

// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
// MARK: - Import

import UIKit


// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
// MARK: - Implementation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {


    // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
    // MARK: - Properties

    public var window: UIWin


    // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
    // MARK: - Methods

    public func applicationDidFinishLaunching(_ application: UIApplication)  {
    
    }

    public func applicationWillResignActive(_ application: UIApplication)  {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    public func applicationDidEnterBackground(_ application: UIApplication)  {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    public func applicationWillEnterForeground(_ application: UIApplication)  {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    public func applicationDidBecomeActive(_ application: UIApplication)  {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    public func applicationWillTerminate(_ application: UIApplication)  {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
}

#4

Hola, tienen razón.
El error que me marca es el siguiente :

class LogoAnimationView: UIView {
var logoGifImageView = UIImageView(gifImage: UIImage(gifName: “gif.gif”), loopCount: 1)_

override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}

EL error que me marca Xcode es :
Call can throw, but errors cannot be thrown out of a property initializer

me lo marca en el UIImage(gifName: “gif.gif”)

No he podido dar con el error, espero me puedan ayudar u orientar.
Muchas gracias


#5

Si revisas en el artículo de medium que agregaste usan la librería SwiftyGif. El método init(gifName:) que estás usando al final tiene un throw (así dando una revisada rápida a la librería, porque nunca la he usado) así que mi sospecha es que pongas lo del logoGifImageView con un try (try? o try!) y su do catch