How to support support dark mode for existing swift app iOS? - ios

I am using Xcode version 11.3.1 and we have not supported the dark mode feature in the latest build. while checking the dark mode in iOS13, all the texts are not visible. It’s working in light mode. But I need to support dark mode as well.
While checking in the dark mode issue, I found solution like below to set the light mode for entire app even if the user select the dark mode:
<key>UIUserInterfaceStyle</key>
<string>Light</string>
But some of them mentioned, if we set this UIUserInterfaceStyle in plist, it will not allow placing the submit the app to App Store.
My question is, I want to support dark mode and I want to submit the app into App Store as well.
or
I need to support only light mode and I want to submit the app into the app store as well.
Note: I am using the app delegate not using SwiftUI.

if you don't set UIUserInterfaceStyle on info.plist then the App automatically enables dark mode depends on the system. If the system runs with dark mode then the app will start with dark mode.
But to show all the texts or other things you have to use the system color as the background and also for texts. OR you can use a custom color for dark mode or light mode.

To make your app look the same in the dark mode as well and it does not hinder the existing UI of the app you can use this line of code in
info.plist <key>UIUserInterfaceStyle</key>
<string>Light</string>
In this way your app will only will support only the light mode.

Related

Why is my app so different on my device vs. the simulator?

This what my app looks like running on the simulator (iPhone 8 Plus):
And this what it looks like running on my device (iPhone 7 Plus):
Why does it look like so much is missing from the app when I run it on my device? Also, a lot of the buttons/actions do not work. My data is sourced from Firestore and I am using Firebase for my app. The iOS Deployment Target is 14.4, which is accurate for my phone. I'm wondering if this could have something to do with my "Copy Bundle Resources" as this has caused me some issues in the past.
Any help/guidance on how I can troubleshoot this is much appreciated!
It Looks like your device is in dark mode. Please do changes in UI to support dark mode or you can use your app by disabling dark mode by referring this
Your device is in the dark theme whereas your simulator is in light theme,
You can assign it to work on a light theme by toggling the appearance as shown in the image below.
It seems like, You haven't provided the support for the Dark mode. To fix this issue, Either you have to give support for dark mode or disable dark mode by adding the below key in the info.plist file. It will fix your issue.
<key>UIUserInterfaceStyle</key>
<string>Light</string>
Thank you everyone for the answers. I did indeed have to disable dark mode. It looks like the key has changed to the following, as per this link: Is it possible to opt-out of dark mode on iOS 13?
<key> Appearance</key>
<string>Light</string>

How to enable dark mode UI effect always for my iOS app even pre ios 13

My iOS app looks great in dark mode.
I googled around but I couldn't find. How to leave the Dark mode effect on my app alone even though device is in light mode.
I don't know how to do it before iOS 13.
Any suggestions are welcome.
You can do this by adding this line of code in app delegate.(For whole app level)
if #available(iOS 13.0, *) {
window?.overrideUserInterfaceStyle = .dark
}
Other option is to specify that mode in plist file
<key>UIUserInterfaceStyle</key>
<string>Dark</string>

CarPlay - In dark mode Apple Maps displayed in light mode

Using iOS 13.3.1 ... noticed that in dark mode, Apple Maps are always displayed in bright light mode. I read in external forums that Apple Maps are connected with headlights. But I haven't seen any documentation about it. Is this true ? Is there any way (code) to display Apple Maps in dark mode when mode is set to dark?
Check if you have forcefully set Light mode for that specific View controller.

Swift - Change iPhone background

I was thinking about changing iPhone background using app. Is there some code in Swift to change iPhone background?
I don´t mean change background of app. I mean change background totally of the iPhone.
There is no way to currently access the device's Wallpaper as of now.
Essentially Apple doesn't allow it, though jailbroken devices can access this functionality.
You also aren't allowed to set or change the wallpaper of the entire phone in third party apps. The user has to do that manually through the settings or photos app. You can add instructions as to how the user can do that in your app.

Is there a way to programmatically check if some specific mobileconfig has been activated?

This solution for an iOS kiosk mode (disabling the home button and on iPad the multitasking gesture) is really great, finally there is a possibility to implement a kiosk mode on iPads (even though it's quite complicated to activate and deactivate).
Lock-down iPhone/iPod/iPad so it can only run one app
I want to use this with a exam/quiz/e-assessement app. But how can my app check if this "kiosk" mode is actually active? Is there a way to programmatically check if some specific mobileconfig has been activated?
Use an MDM tool, like AppBlade. Here's a video on our kiosk mode functionality http://vimeo.com/50632312

Resources