Note: I’m currently at WWDC watching the live sessions, I haven’t been able to include all session details and only the public information, as more information becomes public I will post more details.
Split screens on iPad, ah scary, now we have even more things to worry about.
Just in case you haven’t heard about what multitasking is on the iOS9, it’s basically being able to run two apps side by side on an iPad. There’s three different modes, Slideover, SplitView and Picture-in-Picture.
One of the first things you need to understand about multitasking in general, the User is in control of the apps and the sizes of the apps. You can never set the size of a window.
We all now need to adopt a multitasking mindset, which means two things 1) avoid using device idiom or interface orientation and instead adapt to the window size 2) we need to ensure our apps are ‘good citizens’ and not leaking memory, growing in an unbounded fashion, or blocking the main thread
In regards to handling different sizes and layout, Adaptivity is the solution, if you’ve been using the features like AutoLayout and Size classes then supporting multitasking in your app should be easy. Apple aren’t afraid to say I told you so, ‘participating in iOS 9 multitasking is straightforward when you’ve adopted Apple’s best-practice recommendations for iOS 8.’
If you’re developing with Xamarin.iOS and you’ve been doing it with best practices then this should be a simple transition.
The basic steps to support multi-tasking in your app are:
1) Build your app with iOS 9 SDK
2) Support all orientations
3) Use launch storyboards
If you want to opt-out of multitasking then you can add the key ‘UIRequiresFullScreen’ in your plist, this is not recommended as user will expect that your apps support multitasking and their not going to be happy if they can’t use multitasking. Apple recommends Most apps should adopt Slide Over and Split View.
The simulator in xcode 7 will allow you to simulate the functionality so testing your app them should be fairly easy. Currently only the iPad Air 2 support the full SplitView, I would guess this is due to performance.
The biggest change is about resource management. Every iOS app—even one that opts out of using multitasking features—needs to operate as a good citizen in iOS 9. Now, even full-screen apps don’t have exclusive use of screen real estate, the CPU, memory, or other resources.
It’s important to note that we shouldn’t be using rotation events in iOS9, the events we should be using are similar to this (more details TBA).
Multitasking with Xamarin.Forms first thoughts
If you’re using Xamarin.Forms then there’s no direct support for autolayout or size classes but if you design your layouts to look good at all sizes then you should be ok. I’m feeling that in general multitasking won’t be an issue in Xamarin.Forms, even ‘as-is’ Xamarin.Forms we can use the current system to have adaptable screen sizes using the various Xamarin.Forms layouts like StackLayout, Grid and RelativeLayout. Additionally this is just a thought but possibly, the Xamarin.Forms team could add a Device.Size property which could help us make a decision on how to layout the main areas of the screen, possibly add even a event.
Here’s some initial thoughts on handling the new feature.
- Avoid making layout decisions on Idoim(Tablet/Phone), use the window size
- Avoid making layout decisions on device orientation
- Avoid absolute layout
- Use RelativeLayout, StackLayout and Grid to help with adaptable screen sizes
- MasterDetail should already function correctly
- It would be possible to add (polyfil) an event into Xamarin.Forms to notify when a Screen Size changes, allowing us to change the primary navigation style
One other thing to note is Xamarin.Forms has no concept of ‘readable content guide’, so if you want text content to be a good reading experience in your Xamarin.Forms applications then you’ll need to come up with a alternative solution.
If you have any questions about iOS9 multitasking or Xamarin.Forms feel free to get in touch as I’m always keen to help.