Skip to content

Commit

Permalink
[Miscallaneous] Add splash animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsakaimbo committed Jul 22, 2016
1 parent 770741c commit 9a911d9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
4 changes: 4 additions & 0 deletions GiphySearcher.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
5F4291021D40681D0077AEC2 /* AppNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F4291011D40681D0077AEC2 /* AppNavigationBar.swift */; };
5F4291041D4068D30077AEC2 /* UIImage+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F4291031D4068D30077AEC2 /* UIImage+Color.swift */; };
5F872C361D418B8600A64C5E /* dancing_abe.gif in Resources */ = {isa = PBXBuildFile; fileRef = 5F872C351D418B8600A64C5E /* dancing_abe.gif */; };
5F872C3F1D41BCA100A64C5E /* AppViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F872C3E1D41BCA100A64C5E /* AppViewController.swift */; };
5F995DE91D3DE62400E5944B /* GIF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F995DE81D3DE62400E5944B /* GIF.swift */; };
5F995DEC1D3E85BC00E5944B /* Observable+JSONAble.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F995DEB1D3E85BC00E5944B /* Observable+JSONAble.swift */; };
5F995DEE1D3EB48100E5944B /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F995DED1D3EB48100E5944B /* ViewModel.swift */; };
Expand Down Expand Up @@ -44,6 +45,7 @@
5F4291011D40681D0077AEC2 /* AppNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppNavigationBar.swift; path = Views/AppNavigationBar.swift; sourceTree = "<group>"; };
5F4291031D4068D30077AEC2 /* UIImage+Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Color.swift"; sourceTree = "<group>"; };
5F872C351D418B8600A64C5E /* dancing_abe.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = dancing_abe.gif; sourceTree = "<group>"; };
5F872C3E1D41BCA100A64C5E /* AppViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppViewController.swift; sourceTree = "<group>"; };
5F995DE81D3DE62400E5944B /* GIF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GIF.swift; sourceTree = "<group>"; };
5F995DEB1D3E85BC00E5944B /* Observable+JSONAble.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+JSONAble.swift"; sourceTree = "<group>"; };
5F995DED1D3EB48100E5944B /* ViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -202,6 +204,7 @@
5F995DF11D3EF80900E5944B /* Trending and Search */,
5F995DED1D3EB48100E5944B /* ViewModel.swift */,
5FF38B2D1D4008B300421BC9 /* GIFViewModel.swift */,
5F872C3E1D41BCA100A64C5E /* AppViewController.swift */,
);
path = App;
sourceTree = "<group>";
Expand Down Expand Up @@ -352,6 +355,7 @@
files = (
5F995DF31D3EF82200E5944B /* GIFCollectionViewController.swift in Sources */,
5F995DEC1D3E85BC00E5944B /* Observable+JSONAble.swift in Sources */,
5F872C3F1D41BCA100A64C5E /* AppViewController.swift in Sources */,
5F4291041D4068D30077AEC2 /* UIImage+Color.swift in Sources */,
5F4290F61D40610B0077AEC2 /* UIColor+Custom.swift in Sources */,
5F4291021D40681D0077AEC2 /* AppNavigationBar.swift in Sources */,
Expand Down
45 changes: 45 additions & 0 deletions GiphySearcher/App/AppViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import FLAnimatedImage
import UIKit

class AppViewController: UIViewController {

var API: Networking!

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .whiteColor()

let imageView = FLAnimatedImageView()

let image: FLAnimatedImage = {
let url = NSBundle.mainBundle().URLForResource("dancing_abe", withExtension: "gif")
let data = NSData(contentsOfURL: url!)
let _image = FLAnimatedImage(animatedGIFData: data)
return _image
}()

imageView.contentMode = .ScaleAspectFit
imageView.animatedImage = image

imageView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(imageView)
imageView.heightAnchor.constraintEqualToConstant(300).active = true
imageView.widthAnchor.constraintEqualToConstant(300).active = true
imageView.centerXAnchor.constraintEqualToAnchor(view.centerXAnchor).active = true
imageView.centerYAnchor.constraintEqualToAnchor(view.centerYAnchor).active = true
}


override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

let delay = dispatch_time(DISPATCH_TIME_NOW, Int64(3 * Double(NSEC_PER_SEC)))
dispatch_after(delay, dispatch_get_main_queue()) { [weak self] in
let trendingViewController = GIFCollectionViewController()
trendingViewController.API = self?.API
let navigationController = UINavigationController(rootViewController: trendingViewController)
self?.presentViewController(navigationController, animated: true, completion: nil)
}
}
}
7 changes: 3 additions & 4 deletions GiphySearcher/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
ImageManager.shared = ImageManager(configuration: ImageManagerConfiguration(loader: loader, cache: cache))

window = UIWindow(frame: UIScreen.mainScreen().bounds)
let trendingViewController = GIFCollectionViewController()
trendingViewController.API = API
let navigationController = UINavigationController(rootViewController: trendingViewController)
let appViewController = AppViewController()
appViewController.API = API
window?.backgroundColor = .blackColor()
window?.rootViewController = navigationController
window?.rootViewController = appViewController
window?.makeKeyAndVisible()

return true
Expand Down

0 comments on commit 9a911d9

Please sign in to comment.