How I can make a dynamic splash through WS in swift - iOS? - ios

I need to download and show an image on the Splash of my application. But I don't know if this is possible or a good practice on the splash, even I wanna know if there's a workaround to make this.
Thanks.

LaunchScreen.storyboard (or Xib) is tremendously limited in functionality compared to a regular storyboard. You won't be able to do much on it.
The only possible way is to have a SplashViewController or the name you prefer as first Window's rootViewController. (can be defined in AppDelegate's application(_, didFinishLaunchingWithOptions) or Main interface in General tab of the Application target.
The initial layout of that first SplashViewController should be exactly as your LaunchScreen, trying to avoid a visual jump between them. After that you're free to show whatever you want.
Obviously, if you are going to do network load or any other type of task that delays the launch, it is convenient to show the user something that indicates this work. As far as possible cache so that in future launch the start is as fast and smooth as possible.

Related

Create ViewControllers and make them downloadable

I am working on a project. Project has a lot of ViewContrllers. And taking a lot of space in phone. I wonder if there is any way to make ViewContrllers loading as packages.
For example user selects main menu, main menu and 3 another ViewContrllers associated with it will be downloaded and as soon as the user quits the app they can be erased from the phone.
I know it causes a lot of data usage. But i just wonder is it possible to upload your ViewContrllers on cloud and download them in app when using and remove them after using.
Some ideas:
You could use some kind of React Native, or equivalent, solution.
You could define your View Controllers as JSON and configure a specialised UIViewController with this JSON.
Those ideas aside, I don't think view controllers as XIBS, Storyboard, or in code, should be detrimental to the size of the app.

How can I test a specific screen in my app without navigating all hierarchy until there

Say you are developing Settings.app (the iPhone settings app) and you want to add features in the Text Replacement system.
To test that screen one must go through all the screens Settings > General > Keyboard > Text replacement which is very painful if you do it often.
What are the options to directly test the Text Replacement screen? Or, alternatively, to go the specific screen quickly?
Have in mind that usually we set things up on the previous screens: state, singletons, global variables, etc…
I know there's no magic way to do it. What I'd like to know then is what are your tricks and advices (you use different schemes? you organize your state code in a way that's easier to test the screen?)
You can use storyboards initialViewController checkbox for this purpose. In Storyboard -> ViewController check for property called initialViewController. By enabling this you will directly navigate to that specific screen. Please ignore, if this is not your requirement.
If you dont make that screen apart from other code, it will be really hard, move all the setup from the previous screen to app delegate and set that screen as rootViewcontroller
I usually add a test button that I can hide later in production. You can set it up to skip login but also could include an other code you want in there or go straight to the view you want. I have the button to different functions that can change so that I don't have to add and remove anything else afterwards, just hide the button again or redirect to a new function. You might have to mock some data in your case but if you are just checking the UI as you build it then this is a good quick test method.
if you are using storyboard Select Viewcontroller which you want to test and in storyboard check initialViewController checkbox for this purpose,
so it will launch as your first screen so without navigating to all other screen you can check checkbox of initialViewController.

How to make my LaunchImage load at the same time as the application?

As the application loads, I want to make an image load at the same time, for example, a line would elongate form either side as the application loads, and when it has finished, the line would have reached its maximum length. I have seen this in a few websites, like rime arodaky for example, but I want to this for an iOS application. I have searched on Google but couldn't find anything!
Does anyone know how to do this?
The launch process if we REALY simplify it to accommodate your question, can be split into two parts.
The first part you do not have any control over, and during which a launch image is shown.and it ends with a delegate call-back on the application delegate called
applicationDidFinishLaunchingWithOptions
The second part is you might have some application specific behaviour which requires no activity from the user but you app still isn't interactive.
You need to implement such a progress bar yourself. There is no built in support for this in any of the app templates in Xcode.
You can only do what you want during this second phase. But you have absolutely no control over the first phase, except for that static non-animated launch image.
I think you can just add a photo as a launch image, launch image is just an image.Then you can add the animation when your first view controller appears.You can fake it this way.

iOS, change splash screen by code

Basically, I want my app could change its splash screen by app settings. Settings are saved in plist file.
Actually it's about different language, I want enable my user to choose my app language, even if it's different with the system preferred language.
Is it possible? I searched some answer, suggesting to use another view controller to simulate as splash screen, but my splash screen itself will take some to to load my app, not by my pause. So should I display nothing in the real splash screen?
I wonder if there is a way to change the splash screen by some conditions.
Thanks a guys.
The splash screen will show only for as long as it takes for the appDidFinishLoading method to return YES. One possible solution is for you to have a really simple (not localizable) splash screen and to basically do nothing in this method and return YES straight away.
You can then use an actual view controller as your splash screen that is dynamically initialized and actually does any initialization your app may need in the viewDidAppear method. Once the initialization is done, you can then proceed and show what would normally be your root view controller.
EDIT:
You should also consider, however, that splash screens are not intended to provide any kind of content to the user, as pointed out in this answer.
Apple does not provide a way to do that, as that would involve either modifying the Info.plist or modifying the splash images, both of which would in turn spoil your code signature. It would also open a very ugly can of worms, so modifying Info.plist will probably never be allowed which in turn means you will not be able to change the splash screen dynamically unless Apple adds explicit support for that via some other means. But right now, you're out of luck, I'm afraid.

Progressively load subviews to speed up iOS app performance

I'm looking for a technique to progressively load in the contents of a UIViewController to make an app feel "snappier". I noticed this issue when pushing a viewcontroller onto the stack there's a noticeable delay while waiting for it to push in. The UIViewController's View has some complex subviews with transparency. I'm wondering if I create them after viewDidAppear and 'fade' them in, then the transition will appear much smoother.
I noticed a similar effect in Apple's Trailers app. When tapping a movie in that app the detail view pushes in and the contents load after the fact. Granted part of that delay is because they are downloading the details before showing them, but it seems like they always fadein that large image whether it's been downloaded already or not.
Has anyone had much success with this or with improving UIViewController loads in general.
Before you start making changes in an effort to improve performance, use Instruments to profile your app and find out where the problem really is. Is it in drawing the complex subviews? Is it in loading the data? The only way to know is to measure.
There's no reason you couldn't do as you propose -- have the view controller create/load its main view and then add the complex subviews afterward. Your view controller can add and remove subviews at will. Will that make the app feel snappier? It might -- it's similar to the default image strategy Apple built into iOS, where the OS loads a picture of your interface to make the device seem responsive, and then substitutes the real interface once that's ready. On the other hand, if the user still has to wait for the complex subviews to be created before the view is useful, seeing the rest of the view might not help much.
Another possibility (again, after measuring) might be to create the views before the user needs them. This runs counter to the lazy initialization that iOS apps commonly use to conserve memory and power, but if you know that you're going to need the views and you can expect a lull in user activity before they're needed, it could be a good way to increase the app's apparent speed. All you need to do to get a view controller to create/load its view is to access its view property.

Resources