Dim brightness programmatically below Apple authorization - ios

I'm developing an app where a screen need to be as dark as possible (the app need to run in a room all night long).
I already set a black background and the brightness to 0 using :
UIScreen.main.brightness = (0.0)
But it's still too bright for a good comfort of use.
I've searched around the internet and found
UIScreen.main.wantsSoftwareDimming = true
That I put before my previous code line, but nothing changed.
I've tried the trick with accessibility settings and zoom things, that works well, but that's not a way I'm allowed to use.
So, I'm a bit out of idea and any help would be appreciated.
Is it even still possible to do it?
Is it possible to turn off the backlight? (That would be the best)

It is possible to keep an app running when the screen is off by setting the UIApplicationExitsOnSuspend flag in your Info.plist.
It will only work if your app is in the foreground when the screen is turned off and it will disable any background mode for your app.

Related

iPad detect if the user has Dark Mode enabled, without supporting Dark Mode

I'm working on an iPad app. I would like to know if a user has Dark Mode turned on, without actually supporting Dark Mode.
When I have my iPad in Dark Mode, and I ask the O.S for the userInterfaceStyle it always returns 1 (Light Mode).
In my info.plist I've set the User Interface Style to Light. When I remove this value, asking the O.S for the userInterfaceStyle, I get the correct value.
I understand that we should "just support it", however I need evidence that user's are actually using it before I can allocate the resources necessary to complete the task.
When you set the info.plist key, the style will be overridden on the system level and your app will never receive the user's setting.
Alternatively, you could remove the plist key and instead set overrideUserInterfaceStyle on your main window. All subviews of that window will render in light appearance, but you should be able to check for the system style.
By the way, I think a lot of users are using Dark Mode by now, so it's probably worth the effort.

iOS 11+ launch screen - custom named colors in dark mode

Is it possible to use user defined named colors in the launch screen storyboard?
I tried creating test color in xcassets, with appearances {dark, any} and setting it as Launch screen main view background.
I noticed significant differences:
- in RELEASE my custom colors never work
- in DEBUG some colors work, some are ignored, some are changing values (e.x. dark color is correct, but light is biased), and generally it is a mess
I know I need to delete app every time since launch screen is cached, are there any additional constraints? I fail to get any consistent results. Only thing that seems to work is "System background color".
Similar question goes for images.
OK, so short update. It is possible to use named colors and images with dark appearance on the launch screen after all.
It just works like nightmare. Which means that some parts are getting somehow cached (not sure what is happening underneath).
The final result is that to get consistent results, I had not only to delete app from the device, but also restart the phone.
I also noticed, that images with dark appearance are somehow broken - twice bigger or twice smaller, than their "any" appearance counterparts (even when I used exactly same files). That altogether creates unbelievable mess making it hard to test.
This is still a mess in iOS 13. I ended up using the build in dynamic system colours and tinting them with an overlay.

IOS and Zoom Display

i have issue with zoomed display.
on IOS until today i did not see any changes on my apps when user turn on zoom display .
now i developing an application, use auto layout constraints like always ,
but this is the first time that i saw that when user change setting to zoom display zoomed mode all my app get zoomed and the resolution get messy.
i tried every thing to understand the difference and stil get nothing.
i want to ignore the zoom, that the app act like normal mode,
is this possible?
You can't ignore the scaling... I think adding proper launchscreen file in your target settings may solve your problem.

Disabling the 3D Touch Task Switcher Gesture on the Left Edge of the Screen

If you press firmly on the left edge of the screen using an iPhone with 3D touch you will bring up the task switcher.
I'd like to know how I can disable this behavior in my app.
There is no API for that, just as there isn’t one for disabling any other way of getting out of your app. If you’d like such a thing, you can file an enhancement request with a description of what you’re trying to do.
While there isn't an API for this, it appears that the behavior is constrained to Portrait mode. If you run Apple's TouchCanvas example, you'll see that the gesture doesn't actually work because the app runs in Landscape mode. If you modify the project to support both Portrait and Landscape, you can see the gesture is enabled in Portrait, and disabled in Landscape.
So, that may be a suitable workaround, depending on your use case.
I've filed a Radar for this at https://bugreport.apple.com, suggesting that Apple offers an API similar to being able to set:
self.navigationController?.interactivePopGestureRecognizer.enabled = false
and would suggest that you do the same if seeing the feature is of interest to you. They'll probably close duplicates, but voicing more support couldn't hurt.

How to programmatically set the upper text across all Apps?

I will word this question embarrassingly awkward and primitive as I have spent ten minutes searching for the answer and failed miserably. Please help/nudge to resolve!
Desired IOS Feature
Setting the upper navigation bar over all Apps to a custom color and text value that navigates to a specific App when tapped
Example
The App SleepCycle when it is set to Alarm-Clock mode, and when the User is in any other App other than SleepCycle. The top of the screen then becomes red with the text 'SleepCycle' and when you single-tap it you navigate to SleepCycle
Question
What is this feature called and how do you programmatically implement it?
When I've dabbled with this in the past, the hack(?) I used was to register as a Voice Over IP / audio app in Background Modes. WARNING: I have never tried to ship such an app to the App Store, as it seemed like a dubious approach.

Resources