Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign class to the Splash screen in Swift?

I m trying to change the class for call the web service from my splash screen class but it fire the error message.

Error is:

splash screen has not allowed custom class

like image 234
MiTal Khandhar Avatar asked Oct 11 '16 11:10

MiTal Khandhar


People also ask

How do I change the launch screen in Swift?

Adding a Launch Screen You need to add it manually in the Info. plist file. After opening the file, you should see an entry named Launch Screen. Click the arrow on its left to change the direction.

How do I change the splash screen in Xcode?

Adding splash screen on iOSStart by opening the file ios/app-name. xcodeproj in Xcode. Then, drag the file BootSplash. storyboard under the Project directory in the Xcode file manager on the left side of the Xcode from the path ios/app-name/ directory.

How do I add an image to launch screen Xcode?

Create an image set, select Assets. xcassets, right click New Image Set, give it a name(my image name is launch ) , add two image( 800*800 px @2x one, 1200*1200 px @3x one) under Universal section. Add an ImageView to viewcontroller in LaunchScreen. storyboard.


1 Answers

Your launch storyboard is shown before your app has begun executing, so, as the error says it can't execute code.

You can duplicate the scene from your launch storyboard as the initial view controller of your main storyboard, and in this storyboard you can use a custom UIViewController subclass and call your web service. Once the call is complete you can perform a segue to your required scene.

like image 162
Paulw11 Avatar answered Sep 20 '22 20:09

Paulw11