Toggling things like wifi or bluetooth on and off quickly and conveniently is a feature that has been added to lots of apps and tweaks since very early on since iOS was first jailbroken.
In the past
This trend started off with things like Bossprefs which managed various settings on the device but was a stand alone app and didn’t have much flexibility:
Then you have SBSettings. SBSettings got lots of attention and quickly became one of the default things people installed on their jailbroken devices once they finished jailbreaking. And of cause it has it’s own API so other developers could have it control their things, such as SSH or UserAgentFaker.
The problem with SBSettings API is it was designed quite early in iOS’s history and so isn’t designed very natively and could be much better (more on that later). It has it’s advantages though, isn’t quite simple. Each toggle has a dylib with a few simple C functions. SBSettings opens them and calls the functions to make things happen or check it’s state. It also includes some more advanced options like presenting extra windows to show things like a list of processes running or a slider for the brightness. As a sign of it’s age it must respring to reload it’s settings. When it was designed that was the norm and having a tweak which could adapt to settings on the fly without resrpinging would be a killer feature.
iOS and ObjectiveC has moved on quite a bit now and is much more advanced and more refined then it was. SBSettings was good but after iOS 4 I stopped using it. This was mostly down to notification centre taking over as the “above” window on my device. Having 2 windows that drop down form the top of the screen as a control centre for my device each activated under different circumstances just feels wrong, so I don’t us it anymore (and it although quite a few people still use it, it isn’t as popular as it once was).
NCSettings has mostly replaced it for me. SBSettings has a mode to run inside notification centre but it just doesn’t fit well. It has been adapted quite well, but it and it’s toggles weren’t designed for that purpose. NCSettings by comparison was designed from the start to run in the notification centre and fits in very well with a minimal stripped back design.
And now everything offers some basic controls and toggles. Deck is an example of something like NCSettings designed to do just that. However, lots of tweaks now offer some sort of toggles, Auxo for example extends the simple mute/orientation lock toggle in the switcher to a more general control of the devices basic features. The problem with all these things is they are limited to what you can convince the developer to add support for and anything like SSH or your own add-on which is a separate package and my not be installed on everyones devices is going to be a hard sale to get added. In short none of them have an API and there’s defiantly not a unified API among them. The closest I’ve seen is a tweak using SBSettings API for itself.
Now that I’ve briefly outlined how toggles on iOS currently are I’m going to outline how I think they should, or rather could, be in another blog post.
When I first read this post about iOS 6 and _UIRemoteView’s which allowed apple to move things like email into different processes and still display them as if they where in the app there was one point I that caught my attention more then it would most peoples.
<_UIRemoteView: 0x1e05c300; frame = (0 0; 320 480); transform = [0.5, -0, 0, 0.5, -0, 0]; userInteractionEnabled = NO; layer = <CALayerHost: 0x1e05c460»
CALayerHost, the instant I sure that I thought, “wow, Apple finally put it to good use’. From my experiments with CardSwitcher I have come across CALayerHost’s before. They are actually how CardSwitcher’s live views work. More then displaying part of an app, however, they also allow interaction through to that app (although that is buggy iOS 5, haven’t tested 6 yet). For CardSwitcher to use them as live views into apps it actually has to block interaction, if you remove that you get this http://www.youtube.com/watch?v=1D1NyXITjI0.