ColorAsset

1.0.0

PRNDcompany/ColorAsset

What's New

v1.0.0

2022-12-09T07:46:23Z

The first stable release 🎉

Support SPM (in Xcode 14, Swift 5.7).
Give it a Try!

ColorAsset

Swift Version Platforms License

Why You should use ColorAsset?

  • Since iOS 13, UIKit and SwiftUI Color can be managed together
  • You can formalize the transition between SwiftUI's Color and UIKit's UIColor in a cool way.

Usage

Check out the Example app for more details.

initialize

extension ColorAsset {
    static let brandColor = ColorAsset(hex: "#88FF44")
    static let primaryColor = ColorAsset(named: "primary", bundle: .module, alpha: 1)
}

In SwiftUI

struct ContentView: View {
    var body: some View {
        Text("Hello")
            .foreground(Color(.brandColor)) // or .foreground(.asset(.brandColor))
    }
}

In UIKit or AppKit

let label = UILabel()
label.textColor = .asset(.brandColor)

Requirements

Minimum Version
Swift 5.7
iOS 13.0
macOS 10.15
tvOS 13.0
watchOS 6.0

Installation

ColorAsset is only supported by Swift Package Manager.

To integrate ColorAsset into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:

dependencies: [
  .package(url: "https://github.com/PRNDcompany/ColorAsset", from: "1.0.0"),
]

TODO

  • Support DarkMode
  • Support for multiple variants such as size classes

License

This library is released under the MIT license. See LICENSE for details.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Dec 22 2022 03:51:56 GMT-0500 (GMT-05:00)