My current app is developed in objC and Swift both. i need to support a darkmode. can anyone suggest how can i achieve this by globally?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
Include the .swift file containing the UIColor extension code into your Objective-C code by utilizing the Swift Module. It can be found under Your_Target > Build Settings > Objective-C Generated Interface Header Name
This will generate a header file "MyApp-Swift.h"
Then add @objc to each static color function in the .swift file containing the UIColor extension code to expose it for Objective-C.
In your Objective-C .m file, import the module and then reference the color function from a UIColor extension:
Playground Example
There are couples of semantic system color are available in interface builder of Xcode11-beta. please use those to support both .light and .darkMode
Please follow the basics instructions step by step.
There is also an option to provide different color and different images using code.
Here is the code for adding your color logic should appear in the dark mode.
To know more about adapting dark mode in your iOS application please refer to the following blog post.
How to Adopt iOS 13 Dark Mode in your iOS App
You can try this method:
For Colors:
For Images:
Got this info from a medium post