兼容所有iOS 版本的主题管理工具

218 阅读1分钟
原文链接: github.com

skin manager of iOS

Skin manager, compatible with all iOS versions, currently does not support swiftUI

Install

carthage:

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update $ brew install carthage

To integrate SnapKit into your Xcode project using Carthage, specify it in your Cartfile:

github "https://github.com/imotoboy/skin.git" "master" or github "git@github.com:imotoboy/skin.git" "master"

Run carthage update to build the framework and drag the built Skin.framework into your Xcode project.

Usage

AppDelegate.swift

class AppDelegate: UIResponder, UIApplicationDelegate {
    
    internal var window: UIWindow?
    
    internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        do {
            guard let fileUrl = Bundle.main.url(forResource: "skins.default", withExtension: "plist") else { fatalError() }
            try Skins.shared.setup(withStyle: .current, fileUrl: fileUrl)
        } catch {
            print(error.localizedDescription)
        }
        
        return true
    }

other locations:

view.skin.backgroundColor = .background