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: [
|
||||
.target(name: "DarkModeCore"),
|
||||
.target(name: "DarkModeCore", cSettings: [.define("SWIFT_PACKAGE")]),
|
||||
.target(name: "FluentDarkModeKit", dependencies: ["DarkModeCore"]),
|
||||
.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"
|
||||
|
||||
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
|
||||
|
||||
To integrate FluentDarkModeKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#ifdef SWIFT_PACKAGE
|
||||
#import "DMNamespace.h"
|
||||
#else
|
||||
#import <FluentDarkModeKit/DMNamespace.h>
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#ifdef SWIFT_PACKAGE
|
||||
#import "DMNamespace.h"
|
||||
#else
|
||||
#import <FluentDarkModeKit/DMNamespace.h>
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
#ifndef SWIFT_PACKAGE
|
||||
#define SWIFT_PACKAGE
|
||||
#endif
|
||||
|
||||
#import "../DMDynamicColor.h"
|
||||
#import "../DMDynamicImage.h"
|
||||
#import "../DMNamespace.h"
|
||||
#import "../DMTraitCollection.h"
|
||||
#import "../NSObject+DarkModeKit.h"
|
||||
#import "../UIColor+DarkModeKit.h"
|
||||
#import "../UIImage+DarkModeKit.h"
|
||||
#import "../UIView+DarkModeKit.h"
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
//
|
||||
|
||||
import UIKit
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import DarkModeCore
|
||||
#endif
|
||||
|
||||
public final class DarkModeManager: NSObject {
|
||||
public static func setup() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIApplication: DMTraitEnvironment {
|
||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||
windows.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIButton {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIImageView {
|
||||
|
||||
private struct Constants {
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UILabel {
|
||||
private enum Constants {
|
||||
static var currentThemeKey = "currentThemeKey"
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UINavigationBar {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIPageControl {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIProgressView {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIScrollView {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UISlider {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UITabBar {
|
||||
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||
super.dmTraitCollectionDidChange(previousTraitCollection)
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UITableView {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UITextField {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UITextView {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIToolbar {
|
||||
override func dm_updateDynamicColors() {
|
||||
super.dm_updateDynamicColors()
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIView: DMTraitEnvironment {
|
||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||
subviews.forEach { $0.dmTraitCollectionDidChange(previousTraitCollection) }
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import DarkModeCore
|
||||
#endif
|
||||
|
||||
extension UIViewController: DMTraitEnvironment {
|
||||
open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// Licensed under the MIT License.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIWindow {
|
||||
override open func dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) {
|
||||
super.dmTraitCollectionDidChange(previousTraitCollection)
|
||||
|
|
Загрузка…
Ссылка в новой задаче