Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swap/Change Rootviewcontroller with Animation ios/swift

guard let window = UIApplication.shared.keyWindow else {
    return
}

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MainTabbar")

// Set the new rootViewController of the window.
// Calling "UIView.transition" below will animate the swap.
window.rootViewController = vc

// A mask of options indicating how you want to perform the animations.
let options: UIView.AnimationOptions = .transitionCrossDissolve

// The duration of the transition animation, measured in seconds.
let duration: TimeInterval = 0.3

// Creates a transition animation.
// Though `animations` is optional, the documentation tells us that it must not be nil. ¯\_(ツ)_/¯
UIView.transition(with: window, duration: duration, options: options, animations: {}, completion:
{ completed in
    // maybe do something on completion here
})
Comment

PREVIOUS NEXT
Code Example
Swift :: password reset with phone number in firebase flutter 
Swift :: Swift Character 
Swift :: swift closure 
Swift :: declare empty dictionary in swift 
Swift :: UICollectionviewcontroller reload data 
Swift :: how to figure out ios vesion swift 
Ruby :: rails kill server 
Ruby :: devise generate controller 
Ruby :: ruby lowercase 
Ruby :: rails benchmark 
Ruby :: ruby key exists 
Ruby :: ruby hash transform values 
Ruby :: rails migration polymorphic references 
Ruby :: PG::DatatypeMismatch: ERROR: column "price" cannot be cast automatically to type numeric HINT: You might need t 
Ruby :: rails destroy not working 
Ruby :: rails change column type string to integer 
Ruby :: rails form fields 
Ruby :: ruby max 2 numbers 
Ruby :: print in ruby 
Ruby :: ruby change directory 
Ruby :: random datetime ruby 
Ruby :: ruby string trmi 
Ruby :: rails model naming convention 
Ruby :: ruby find max value in array 
Ruby :: ruby refinement include module 
Ruby :: ruby and or 
Ruby :: ruby map 
Ruby :: logstasher-logger gem 
Ruby :: ruby nil to float is 0.00 
Ruby :: ruby zip rows and columns 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =