Fix importing via spm (#69)
* Fix SPM * Update README.md * Use @_exported to remove duplicate imports
This commit is contained in:
Родитель
b89745dc06
Коммит
ae1f137759
|
@ -12,7 +12,7 @@ let package = Package(
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(name: "DarkModeCore"),
|
.target(name: "DarkModeCore", cSettings: [.define("SWIFT_PACKAGE")]),
|
||||||
.target(name: "FluentDarkModeKit", dependencies: ["DarkModeCore"]),
|
.target(name: "FluentDarkModeKit", dependencies: ["DarkModeCore"]),
|
||||||
.testTarget(name: "FluentDarkModeKitTests", dependencies: ["FluentDarkModeKit"]),
|
.testTarget(name: "FluentDarkModeKitTests", dependencies: ["FluentDarkModeKit"]),
|
||||||
]
|
]
|
||||||
|
|
|
@ -38,6 +38,12 @@ github "microsoft/FluentDarkModeKit"
|
||||||
|
|
||||||
Click "Files -> Swift Package Manager -> Add Package Dependency..." in Xcode's menu and search "https://github.com/microsoft/FluentDarkModeKit"
|
Click "Files -> Swift Package Manager -> Add Package Dependency..." in Xcode's menu and search "https://github.com/microsoft/FluentDarkModeKit"
|
||||||
|
|
||||||
|
Since Xcode uses its own tools to handle swifft packages, git-lfs might not be picked up if it is installed via Homebrew. Run the following command to create a symbolic link if Xcode fails to fetch the package:
|
||||||
|
|
||||||
|
```
|
||||||
|
ln -s /usr/local/bin/git-lfs $(xcode-select -p)/usr/bin/git-lfs
|
||||||
|
```
|
||||||
|
|
||||||
### CocoaPods
|
### CocoaPods
|
||||||
|
|
||||||
To integrate FluentDarkModeKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
To integrate FluentDarkModeKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
#ifdef SWIFT_PACKAGE
|
||||||
|
#import "DMNamespace.h"
|
||||||
|
#else
|
||||||
#import <FluentDarkModeKit/DMNamespace.h>
|
#import <FluentDarkModeKit/DMNamespace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
#ifdef SWIFT_PACKAGE
|
||||||
|
#import "DMNamespace.h"
|
||||||
|
#else
|
||||||
#import <FluentDarkModeKit/DMNamespace.h>
|
#import <FluentDarkModeKit/DMNamespace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
|
#ifndef SWIFT_PACKAGE
|
||||||
|
#define SWIFT_PACKAGE
|
||||||
|
#endif
|
||||||
|
|
||||||
#import "../DMDynamicColor.h"
|
#import "../DMDynamicColor.h"
|
||||||
#import "../DMDynamicImage.h"
|
#import "../DMDynamicImage.h"
|
||||||
|
#import "../DMNamespace.h"
|
||||||
#import "../DMTraitCollection.h"
|
#import "../DMTraitCollection.h"
|
||||||
#import "../NSObject+DarkModeKit.h"
|
#import "../NSObject+DarkModeKit.h"
|
||||||
|
#import "../UIColor+DarkModeKit.h"
|
||||||
|
#import "../UIImage+DarkModeKit.h"
|
||||||
|
#import "../UIView+DarkModeKit.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#if SWIFT_PACKAGE
|
||||||
|
@_exported import DarkModeCore
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class DarkModeManager: NSObject {
|
public final class DarkModeManager: NSObject {
|
||||||
public static func setup() {
|
public static func setup() {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIApplication: DMTraitEnvironment {
|
extension UIApplication: DMTraitEnvironment {
|
||||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||||
windows.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
windows.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIButton {
|
extension UIButton {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIImageView {
|
extension UIImageView {
|
||||||
|
|
||||||
private struct Constants {
|
private struct Constants {
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UILabel {
|
extension UILabel {
|
||||||
private enum Constants {
|
private enum Constants {
|
||||||
static var currentThemeKey = "currentThemeKey"
|
static var currentThemeKey = "currentThemeKey"
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UINavigationBar {
|
extension UINavigationBar {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIPageControl {
|
extension UIPageControl {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIProgressView {
|
extension UIProgressView {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIScrollView {
|
extension UIScrollView {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UISlider {
|
extension UISlider {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UITabBar {
|
extension UITabBar {
|
||||||
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||||
super.dmTraitCollectionDidChange(previousTraitCollection)
|
super.dmTraitCollectionDidChange(previousTraitCollection)
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UITableView {
|
extension UITableView {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UITextField {
|
extension UITextField {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UITextView {
|
extension UITextView {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIToolbar {
|
extension UIToolbar {
|
||||||
override func dm_updateDynamicColors() {
|
override func dm_updateDynamicColors() {
|
||||||
super.dm_updateDynamicColors()
|
super.dm_updateDynamicColors()
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIView: DMTraitEnvironment {
|
extension UIView: DMTraitEnvironment {
|
||||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||||
subviews.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
subviews.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if SWIFT_PACKAGE
|
|
||||||
import DarkModeCore
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extension UIViewController: DMTraitEnvironment {
|
extension UIViewController: DMTraitEnvironment {
|
||||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||||
setNeedsStatusBarAppearanceUpdate()
|
setNeedsStatusBarAppearanceUpdate()
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIWindow {
|
extension UIWindow {
|
||||||
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||||
super.dmTraitCollectionDidChange(previousTraitCollection)
|
super.dmTraitCollectionDidChange(previousTraitCollection)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче