├── Example ├── Example │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── ExampleApp.swift │ ├── ColorAsset+Constant.swift │ └── ContentView.swift ├── .gitignore └── Example.xcodeproj │ └── project.pbxproj ├── Tests └── ColorAssetTests │ ├── Resources │ ├── Media.xcassets │ │ ├── Contents.json │ │ └── 3362E4.colorset │ │ │ └── Contents.json │ └── Bundle+Resources.swift │ ├── Helper │ └── Converter.swift │ └── ColorAssetTests.swift ├── .gitignore ├── Sources └── ColorAsset │ ├── ColorAsset+Alpha.swift │ ├── ColorAsset+Convertible.swift │ ├── ColorAsset+Convertible+Alpha.swift │ ├── ColorAsset+NSColor.swift │ ├── ColorAsset+UIColor.swift │ ├── ColorInputError.swift │ ├── ColorAsset+SwiftUI.swift │ ├── ColorAsset.swift │ ├── ColorAsset+Hex+String.swift │ ├── ColorAsset+Hex+UInt.swift │ └── ColorAsset+ColorType.swift ├── Package.swift ├── LICENSE └── README.md /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Tests/ColorAssetTests/Resources/Media.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Example/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/config/registries.json 8 | .swiftpm/xcode/package.xcworkspace/* 9 | .netrc -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/Example/ExampleApp.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | import SwiftUI 4 | 5 | @main 6 | struct ExampleApp: App { 7 | var body: some Scene { 8 | WindowGroup { 9 | ContentView() 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+Alpha.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public extension ColorAsset { 7 | @available(*, deprecated, message: "Alpha(ColorAssetConvertible)를 사용하세요") 8 | func with(alpha: Double) -> ColorAsset { 9 | var color = self 10 | color.alpha = alpha 11 | return color 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+Convertible.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public protocol ColorAssetConvertible { 7 | func convert(_ color: ColorAsset) -> ColorAsset 8 | } 9 | 10 | extension ColorAsset { 11 | public func convert(_ converter: ColorAssetConvertible) -> ColorAsset { 12 | converter.convert(self) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Tests/ColorAssetTests/Helper/Converter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Converter.swift 3 | // 4 | // 5 | // Created by woody on 2022/10/27. 6 | // 7 | 8 | import Foundation 9 | 10 | 11 | struct Converter { 12 | static func convert(_ input: Double) -> String? { 13 | let numberFomatter = NumberFormatter() 14 | numberFomatter.roundingMode = .halfUp 15 | numberFomatter.maximumSignificantDigits = 3 16 | return numberFomatter.string(for: input) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Tests/ColorAssetTests/Resources/Media.xcassets/3362E4.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.894", 9 | "green" : "0.384", 10 | "red" : "0.200" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+Convertible+Alpha.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public struct AlphaComponent: ColorAssetConvertible { 7 | var rawValue: Double 8 | 9 | public init(rawValue: Double) { 10 | self.rawValue = rawValue 11 | } 12 | 13 | public func convert(_ color: ColorAsset) -> ColorAsset { 14 | var copy = color 15 | copy.alpha = rawValue 16 | return copy 17 | } 18 | } 19 | 20 | extension ColorAsset { 21 | public func alpha(_ value: AlphaComponent) -> ColorAsset { 22 | convert(value) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 6.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "ColorAsset", 8 | platforms: [ 9 | .macOS(.v10_15), 10 | .iOS(.v13), 11 | .macCatalyst(.v13), 12 | .tvOS(.v13), 13 | .watchOS(.v6) 14 | ], 15 | products: [ 16 | .library(name: "ColorAsset", targets: ["ColorAsset"]), 17 | ], 18 | targets: [ 19 | .target(name: "ColorAsset", dependencies: []), 20 | .testTarget(name: "ColorAssetTests", dependencies: ["ColorAsset"]), 21 | ] 22 | ) 23 | -------------------------------------------------------------------------------- /Example/Example/ColorAsset+Constant.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | import ColorAsset 4 | 5 | extension ColorAsset { 6 | static var baseWhite = ColorAsset(hex: "#FFFFFF") 7 | static var baseBlack = ColorAsset(hex: "#000000") 8 | 9 | static var basePrimary = ColorAsset(hex: "#88FF44") 10 | static var base32 = ColorAsset.basePrimary.alpha(.a32) 11 | static var base16 = ColorAsset.basePrimary.alpha(.a16) 12 | static var base8 = ColorAsset.basePrimary.alpha(.a08) 13 | } 14 | 15 | extension AlphaComponent { 16 | static let a32 = AlphaComponent(rawValue: 0.32) 17 | static let a16 = AlphaComponent(rawValue: 0.16) 18 | static let a08 = AlphaComponent(rawValue: 0.08) 19 | } 20 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | .DS_Store 4 | 5 | # Xcode 6 | build/ 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # CocoaPods 23 | Pods 24 | 25 | # Carthage 26 | # 27 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 28 | # Carthage/Checkouts 29 | Carthage 30 | Carthage/Build 31 | 32 | ### Xcode ### 33 | build 34 | *.xcodeproj/* 35 | !*.xcodeproj/project.pbxproj 36 | !*.xcworkspace/contents.xcworkspacedata 37 | **/.swiftpm 38 | 39 | # Exclude Font file 40 | # *.ttf 41 | # *.otf 42 | 43 | SourcePackages -------------------------------------------------------------------------------- /Example/Example/ContentView.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | import SwiftUI 4 | 5 | import ColorAsset 6 | 7 | struct ContentView: View { 8 | var colors: [ColorAsset] = [ 9 | ColorAsset.baseWhite, 10 | ColorAsset.baseBlack, 11 | ColorAsset.basePrimary, 12 | ColorAsset.base8, 13 | ColorAsset.base16, 14 | ColorAsset.base32 15 | ] 16 | 17 | var body: some View { 18 | Form { 19 | ForEach(colors, id: \.self) { 20 | Text("This is PRND OpenSource") 21 | .foregroundColor(.asset($0)) 22 | } 23 | } 24 | } 25 | } 26 | 27 | struct ContentView_Previews: PreviewProvider { 28 | static var previews: some View { 29 | ContentView() 30 | .preferredColorScheme(.dark) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Tests/ColorAssetTests/ColorAssetTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import ColorAsset 3 | 4 | final class ColorAssetTests: XCTestCase { 5 | func test_hexInit() throws { 6 | 7 | let target = ColorAsset(hex: "#3362E4") 8 | 9 | XCTAssertEqual(target.red, 51.0 / 255.0) 10 | XCTAssertEqual(target.green, 98.0 / 255.0) 11 | XCTAssertEqual(target.blue, 228.0 / 255.0) 12 | } 13 | 14 | func test_namedColor() throws { 15 | let target = ColorAsset(named: "3362E4", bundle: .colorAssetTests, alpha: 1) 16 | 17 | XCTAssertEqual(Converter.convert(target.red), Converter.convert(51.0 / 255.0)) 18 | XCTAssertEqual(Converter.convert(target.green), Converter.convert(98.0 / 255.0)) 19 | XCTAssertEqual(Converter.convert(target.blue), Converter.convert(228.0 / 255.0)) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+NSColor.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | #if canImport(AppKit) && !targetEnvironment(macCatalyst) 4 | import AppKit 5 | 6 | public extension NSColor { 7 | static func asset(_ color: ColorAsset) -> NSColor { 8 | color.toNSColor() 9 | } 10 | } 11 | 12 | public extension ColorAsset { 13 | func toNSColor() -> NSColor { 14 | switch colorType { 15 | case let .literal(red, green, blue): 16 | return NSColor( 17 | red: CGFloat(red), 18 | green: CGFloat(green), 19 | blue: CGFloat(blue), 20 | alpha: CGFloat(alpha) 21 | ) 22 | 23 | case let .asset(named, bundle): 24 | let color = NSColor(named: named, bundle: bundle)! 25 | guard let alpha = self._alpha else { return color } 26 | return color.withAlphaComponent(CGFloat(alpha)) 27 | } 28 | } 29 | } 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+UIColor.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | #if canImport(UIKit) 4 | import UIKit 5 | 6 | public extension UIColor { 7 | static func asset(_ color: ColorAsset) -> UIColor { 8 | color.toUIColor() 9 | } 10 | } 11 | 12 | public extension ColorAsset { 13 | func toUIColor() -> UIColor { 14 | switch colorType { 15 | case let .literal(red, green, blue): 16 | return UIColor( 17 | red: CGFloat(red), 18 | green: CGFloat(green), 19 | blue: CGFloat(blue), 20 | alpha: CGFloat(alpha) 21 | ) 22 | 23 | case let .asset(named, bundle): 24 | #if os(watchOS) 25 | let color = UIColor(named: named)! 26 | #else 27 | let color = UIColor(named: named, in: bundle, compatibleWith: nil)! 28 | #endif 29 | guard let alpha = self._alpha else { return color } 30 | return color.withAlphaComponent(CGFloat(alpha)) 31 | } 32 | } 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorInputError.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public enum ColorInputError: Error { 7 | case missingHashMarkAsPrefix(String) 8 | case unableToScanHexValue(String) 9 | case mismatchedHexStringLength(String) 10 | case unableToOutputHexStringForWideDisplayColor 11 | } 12 | 13 | extension ColorInputError: LocalizedError { 14 | 15 | public var errorDescription: String? { 16 | switch self { 17 | case .missingHashMarkAsPrefix(let hex): 18 | return "Invalid RGB string, missing '#' as prefix in \(hex)" 19 | 20 | case .unableToScanHexValue(let hex): 21 | return "Scan \(hex) error" 22 | 23 | case .mismatchedHexStringLength(let hex): 24 | return "Invalid RGB string from \(hex), number of characters after '#' should be either 3, 4, 6 or 8" 25 | 26 | case .unableToOutputHexStringForWideDisplayColor: 27 | return "Unable to output hex string for wide display color" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 PRND 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+SwiftUI.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 PRND. All rights reserved. 2 | 3 | import SwiftUI 4 | 5 | 6 | public extension Color { 7 | 8 | @available(*, deprecated, renamed: "Color(asset:)", message: "This initializer will be removed soon. Please use Color(asset:) instead.") 9 | init(_ color: ColorAsset) { 10 | self.init(asset: color) 11 | } 12 | 13 | init(asset color: ColorAsset) { 14 | switch color.colorType { 15 | case let .literal(red, green, blue): 16 | self = Color(.sRGB, red: red, green: green, blue: blue, opacity: color.alpha) 17 | 18 | case let .asset(named, bundle): 19 | let _color = Color(named, bundle: bundle) 20 | if let opacity = color._alpha { 21 | self = _color.opacity(opacity) 22 | } else { 23 | self = _color 24 | } 25 | } 26 | } 27 | 28 | static func asset(_ color: ColorAsset) -> Color { 29 | Color(asset: color) 30 | } 31 | } 32 | 33 | 34 | public extension ColorAsset { 35 | func toColor() -> Color { 36 | Color(asset: self) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public struct ColorAsset: Equatable, Hashable, Sendable { 7 | public var red: Double { 8 | colorType.components.red 9 | } 10 | 11 | public var green: Double { 12 | colorType.components.green 13 | } 14 | 15 | public var blue: Double { 16 | colorType.components.blue 17 | } 18 | 19 | public var alpha: Double { 20 | get { _alpha ?? 1 } 21 | set { _alpha = newValue } 22 | } 23 | 24 | public init(red: Double, green: Double, blue: Double, alpha: Double) { 25 | self.colorType = .literal(red: red, green: green, blue: blue) 26 | self._alpha = alpha 27 | } 28 | 29 | public init(named: String, bundle: Bundle?, alpha: Double? = nil) { 30 | self.colorType = .asset(named: named, bundle: bundle) 31 | self._alpha = alpha 32 | } 33 | 34 | // MARK: Internal 35 | enum ColorType: Hashable { 36 | case literal(red: Double, green: Double, blue: Double) 37 | case asset(named: String, bundle: Bundle?) 38 | } 39 | 40 | var colorType: ColorType 41 | var _alpha: Double? 42 | } 43 | -------------------------------------------------------------------------------- /Tests/ColorAssetTests/Resources/Bundle+Resources.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by 김태완 on 2021/04/15. 6 | // 7 | 8 | import Foundation 9 | 10 | private class CurrentBundleFinder {} 11 | 12 | extension Foundation.Bundle { 13 | //https://stackoverflow.com/questions/64540082/xcode-12-swiftui-preview-doesnt-work-on-swift-package-when-have-another-swift 14 | public static var colorAssetTests: Bundle = { 15 | 16 | /* The name of your local package, prepended by "LocalPackages_" for iOS and "PackageName_" for macOS. You may have same PackageName and TargetName*/ 17 | 18 | let bundleName = "ColorAsset_ColorAssetTests" 19 | 20 | let candidates = [ 21 | 22 | /* Bundle should be present here when the package is linked into an App. */ 23 | 24 | Bundle.main.resourceURL, 25 | 26 | /* Bundle should be present here when the package is linked into a framework. */ 27 | 28 | Bundle(for: CurrentBundleFinder.self).resourceURL, 29 | 30 | /* For command-line tools. */ 31 | 32 | Bundle.main.bundleURL, 33 | 34 | /* Bundle should be present here when running previews from a different package (this is the path to "…/Debug-iphonesimulator/"). */ 35 | 36 | Bundle(for: CurrentBundleFinder.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent(), 37 | 38 | Bundle(for: CurrentBundleFinder.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent(), 39 | 40 | ] 41 | 42 | for candidate in candidates { 43 | let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") 44 | if let bundle = bundlePath.flatMap(Bundle.init(url:)) { 45 | return bundle 46 | } 47 | } 48 | 49 | fatalError("unable to find bundle") 50 | 51 | }() 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+Hex+String.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public extension ColorAsset { 7 | 8 | var hex: String { 9 | let components = colorType.components 10 | let rgb:Int = (Int)(components.red*255)<<16 | (Int)(components.green*255)<<8 | (Int)(components.blue*255)<<0 11 | return NSString(format:"#%06x", rgb) as String 12 | } 13 | 14 | init(hex: String) { 15 | do { 16 | try self.init(rgba_throws: hex) 17 | } catch { 18 | self.init(hex6: 0xFFFFFF) 19 | } 20 | } 21 | 22 | init?(hex: String?) { 23 | guard let hex = hex else { 24 | return nil 25 | } 26 | self.init(hex: hex) 27 | } 28 | /** 29 | The rgba string representation of color with alpha of the form #RRGGBBAA/#RRGGBB, throws error. 30 | 31 | - parameter rgba: String value. 32 | */ 33 | init(rgba_throws rgba: String) throws { 34 | guard rgba.hasPrefix("#") else { 35 | let error = ColorInputError.missingHashMarkAsPrefix(rgba) 36 | print(error.localizedDescription) 37 | throw error 38 | } 39 | 40 | let hexString: String = String(rgba[String.Index(utf16Offset: 1, in: rgba)...]) 41 | var hexValue: UInt64 = 0 42 | 43 | guard Scanner(string: hexString).scanHexInt64(&hexValue) else { 44 | let error = ColorInputError.unableToScanHexValue(rgba) 45 | print(error.localizedDescription) 46 | throw error 47 | } 48 | 49 | switch (hexString.count) { 50 | case 3: 51 | self.init(hex3: UInt16(hexValue)) 52 | case 4: 53 | self.init(hex4: UInt16(hexValue)) 54 | case 6: 55 | self.init(hex6: UInt32(hexValue)) 56 | case 8: 57 | self.init(hex8: UInt32(hexValue)) 58 | default: 59 | let error = ColorInputError.mismatchedHexStringLength(rgba) 60 | throw error 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ColorAsset 2 | 3 | [![Swift](https://img.shields.io/badge/Swift-5.7-orange.svg)]() 4 | [![Version](https://img.shields.io/github/v/release/PRNDcompany/ColorAsset.svg)](https://opensource.org/licenses/Apache-2.0) 5 | [![Platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-yellow.svg)]() 6 | [![License](https://img.shields.io/badge/license-MIT-lightgray.svg)](https://opensource.org/licenses/Apache-2.0) 7 | 8 | ## Why You should use ColorAsset? 9 | 10 | - Since iOS 13, UIKit and SwiftUI Color can be managed together 11 | - You can formalize the transition between SwiftUI's Color and UIKit's UIColor in a cool way. 12 | 13 | 14 | ## Usage 15 | 16 | Check out the [Example](Example) app for more details. 17 | 18 | ### initialize 19 | 20 | ```swift 21 | extension ColorAsset { 22 | static let brandColor = ColorAsset(hex: "#88FF44") 23 | static let primaryColor = ColorAsset(named: "primary", bundle: .module, alpha: 1) 24 | } 25 | ``` 26 | 27 | ### In SwiftUI 28 | 29 | ```swift 30 | struct ContentView: View { 31 | var body: some View { 32 | Text("Hello") 33 | .foreground(Color(.brandColor)) // or .foreground(.asset(.brandColor)) 34 | } 35 | } 36 | 37 | ``` 38 | 39 | ### In UIKit or AppKit 40 | 41 | ```swift 42 | let label = UILabel() 43 | label.textColor = .asset(.brandColor) 44 | ``` 45 | 46 | 47 | ## Requirements 48 | 49 | | |Minimum Version| 50 | |-------:|--------------:| 51 | |Swift |5.7 | 52 | |iOS |13.0 | 53 | |macOS |10.15 | 54 | |tvOS |13.0 | 55 | |watchOS |6.0 | 56 | 57 | ## Installation 58 | 59 | **ColorAsset** is only supported by Swift Package Manager. 60 | 61 | To integrate **ColorAsset** into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`: 62 | 63 | ```swift 64 | dependencies: [ 65 | .package(url: "https://github.com/PRNDcompany/ColorAsset", from: "1.0.0"), 66 | ] 67 | ``` 68 | 69 | ## TODO 70 | 71 | - [ ] Support DarkMode 72 | - [ ] Support for multiple variants such as size classes 73 | 74 | 75 | ## License 76 | 77 | This library is released under the MIT license. See [LICENSE](LICENSE) for details. 78 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+Hex+UInt.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | 6 | public extension ColorAsset { 7 | /** 8 | The shorthand three-digit hexadecimal representation of color. 9 | #RGB defines to the color #RRGGBB. 10 | 11 | - parameter hex3: Three-digit hexadecimal value. 12 | - parameter alpha: 0.0 - 1.0. The default is 1.0. 13 | */ 14 | init(hex3: UInt16, alpha: Double = 1) { 15 | let divisor = Double(15) 16 | let red = Double((hex3 & 0xF00) >> 8) / divisor 17 | let green = Double((hex3 & 0x0F0) >> 4) / divisor 18 | let blue = Double(hex3 & 0x00F) / divisor 19 | 20 | self.colorType = .literal(red: red, green: green, blue: blue) 21 | self.alpha = alpha 22 | } 23 | 24 | /** 25 | The shorthand four-digit hexadecimal representation of color with alpha. 26 | #RGBA defines to the color #RRGGBBAA. 27 | 28 | - parameter hex4: Four-digit hexadecimal value. 29 | */ 30 | init(hex4: UInt16) { 31 | let divisor = Double(15) 32 | let red = Double((hex4 & 0xF000) >> 12) / divisor 33 | let green = Double((hex4 & 0x0F00) >> 8) / divisor 34 | let blue = Double((hex4 & 0x00F0) >> 4) / divisor 35 | 36 | self.colorType = .literal(red: red, green: green, blue: blue) 37 | self.alpha = Double(hex4 & 0x000F) / divisor 38 | } 39 | 40 | /** 41 | The six-digit hexadecimal representation of color of the form #RRGGBB. 42 | 43 | - parameter hex6: Six-digit hexadecimal value. 44 | */ 45 | init(hex6: UInt32, alpha: Double = 1) { 46 | let divisor = Double(255) 47 | let red = Double((hex6 & 0xFF0000) >> 16) / divisor 48 | let green = Double((hex6 & 0x00FF00) >> 8) / divisor 49 | let blue = Double(hex6 & 0x0000FF) / divisor 50 | 51 | self.colorType = .literal(red: red, green: green, blue: blue) 52 | self.alpha = alpha 53 | } 54 | 55 | /** 56 | The six-digit hexadecimal representation of color with alpha of the form #RRGGBBAA. 57 | 58 | - parameter hex8: Eight-digit hexadecimal value. 59 | */ 60 | init(hex8: UInt32) { 61 | let divisor = Double(255) 62 | let red = Double((hex8 & 0xFF000000) >> 24) / divisor 63 | let green = Double((hex8 & 0x00FF0000) >> 16) / divisor 64 | let blue = Double((hex8 & 0x0000FF00) >> 8) / divisor 65 | 66 | self.colorType = .literal(red: red, green: green, blue: blue) 67 | self.alpha = Double(hex8 & 0x000000FF) / divisor 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Sources/ColorAsset/ColorAsset+ColorType.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 PRND. All rights reserved. 2 | 3 | import Foundation 4 | 5 | #if canImport(UIKit) 6 | import UIKit 7 | #elseif canImport(AppKit) 8 | import AppKit 9 | #endif 10 | 11 | 12 | extension ColorAsset.ColorType { 13 | var components: (red: Double, green: Double, blue: Double) { 14 | switch self { 15 | case let .literal(red, green, blue): 16 | return (red, green, blue) 17 | case let .asset(named, bundle): 18 | #if canImport(UIKit) && os(watchOS) 19 | let color = UIColor(named: named)! 20 | let components = color.components 21 | return (Double(components.red), Double(components.green), Double(components.blue)) 22 | #elseif canImport(UIKit) 23 | let color = UIColor(named: named, in: bundle, compatibleWith: nil)! 24 | let components = color.components 25 | return (Double(components.red), Double(components.green), Double(components.blue)) 26 | #elseif canImport(AppKit) 27 | let color = NSColor(named: named, bundle: bundle)! 28 | let components = color.components 29 | return (Double(components.red), Double(components.green), Double(components.blue)) 30 | #else 31 | return (0,0,0) 32 | #endif 33 | } 34 | } 35 | } 36 | 37 | #if canImport(UIKit) 38 | private extension UIColor { 39 | typealias RGBA = (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) 40 | var rgba: RGBA? { 41 | var (r, g, b, a): RGBA = (0, 0, 0, 0) 42 | return getRed(&r, green: &g, blue: &b, alpha: &a) ? (r,g,b,a) : nil 43 | } 44 | var r: CGFloat? { 45 | var red: CGFloat = .zero 46 | return getRed(&red, green: nil, blue: nil, alpha: nil) ? red : nil 47 | } 48 | var g: CGFloat? { 49 | var green: CGFloat = .zero 50 | return getRed(nil, green: &green, blue: nil, alpha: nil) ? green : nil 51 | } 52 | var b: CGFloat? { 53 | var blue: CGFloat = .zero 54 | return getRed(nil, green: nil, blue: &blue, alpha: nil) ? blue : nil 55 | } 56 | var a: CGFloat? { 57 | var alpha: CGFloat = .zero 58 | return getRed(nil, green: nil, blue: nil, alpha: &alpha) ? alpha : nil 59 | } 60 | 61 | var components: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { 62 | let coreImageColor = self.rgba ?? (0,0,0,0) 63 | return (coreImageColor.red, coreImageColor.green, coreImageColor.blue, coreImageColor.alpha) 64 | } 65 | } 66 | #endif 67 | 68 | #if canImport(AppKit) && !targetEnvironment(macCatalyst) 69 | private extension NSColor { 70 | var coreImageColor: CIColor? { 71 | CIColor(color: self) 72 | } 73 | var components: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { 74 | guard let coreImageColor else { 75 | return (0, 0, 0, 0) 76 | } 77 | return (coreImageColor.red, coreImageColor.green, coreImageColor.blue, coreImageColor.alpha) 78 | } 79 | } 80 | #endif 81 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EF2C88B12943163700A59DB3 /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF2C88B02943163700A59DB3 /* ExampleApp.swift */; }; 11 | EF2C88B32943163700A59DB3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF2C88B22943163700A59DB3 /* ContentView.swift */; }; 12 | EF2C88B52943163800A59DB3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EF2C88B42943163800A59DB3 /* Assets.xcassets */; }; 13 | EF2C88B82943163800A59DB3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EF2C88B72943163800A59DB3 /* Preview Assets.xcassets */; }; 14 | EFF16671294316C80001B857 /* ColorAsset+Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFF16670294316C80001B857 /* ColorAsset+Constant.swift */; }; 15 | EFF16675294317690001B857 /* ColorAsset in Frameworks */ = {isa = PBXBuildFile; productRef = EFF16674294317690001B857 /* ColorAsset */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | EF2C88AD2943163700A59DB3 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | EF2C88B02943163700A59DB3 /* ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleApp.swift; sourceTree = ""; }; 21 | EF2C88B22943163700A59DB3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | EF2C88B42943163800A59DB3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | EF2C88B72943163800A59DB3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 24 | EFF1666F2943169F0001B857 /* ColorAsset */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = ColorAsset; path = ..; sourceTree = ""; }; 25 | EFF16670294316C80001B857 /* ColorAsset+Constant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ColorAsset+Constant.swift"; sourceTree = ""; }; 26 | /* End PBXFileReference section */ 27 | 28 | /* Begin PBXFrameworksBuildPhase section */ 29 | EF2C88AA2943163700A59DB3 /* Frameworks */ = { 30 | isa = PBXFrameworksBuildPhase; 31 | buildActionMask = 2147483647; 32 | files = ( 33 | EFF16675294317690001B857 /* ColorAsset in Frameworks */, 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | EF2C88A42943163700A59DB3 = { 41 | isa = PBXGroup; 42 | children = ( 43 | EFF1666E2943169F0001B857 /* Packages */, 44 | EF2C88AF2943163700A59DB3 /* Example */, 45 | EF2C88AE2943163700A59DB3 /* Products */, 46 | EFF16673294317690001B857 /* Frameworks */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | EF2C88AE2943163700A59DB3 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | EF2C88AD2943163700A59DB3 /* Example.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | EF2C88AF2943163700A59DB3 /* Example */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | EF2C88B02943163700A59DB3 /* ExampleApp.swift */, 62 | EF2C88B22943163700A59DB3 /* ContentView.swift */, 63 | EFF16670294316C80001B857 /* ColorAsset+Constant.swift */, 64 | EF2C88B42943163800A59DB3 /* Assets.xcassets */, 65 | EF2C88B62943163800A59DB3 /* Preview Content */, 66 | ); 67 | path = Example; 68 | sourceTree = ""; 69 | }; 70 | EF2C88B62943163800A59DB3 /* Preview Content */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | EF2C88B72943163800A59DB3 /* Preview Assets.xcassets */, 74 | ); 75 | path = "Preview Content"; 76 | sourceTree = ""; 77 | }; 78 | EFF1666E2943169F0001B857 /* Packages */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | EFF1666F2943169F0001B857 /* ColorAsset */, 82 | ); 83 | name = Packages; 84 | sourceTree = ""; 85 | }; 86 | EFF16673294317690001B857 /* Frameworks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | /* End PBXGroup section */ 94 | 95 | /* Begin PBXNativeTarget section */ 96 | EF2C88AC2943163700A59DB3 /* Example */ = { 97 | isa = PBXNativeTarget; 98 | buildConfigurationList = EF2C88BB2943163800A59DB3 /* Build configuration list for PBXNativeTarget "Example" */; 99 | buildPhases = ( 100 | EF2C88A92943163700A59DB3 /* Sources */, 101 | EF2C88AA2943163700A59DB3 /* Frameworks */, 102 | EF2C88AB2943163700A59DB3 /* Resources */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = Example; 109 | packageProductDependencies = ( 110 | EFF16674294317690001B857 /* ColorAsset */, 111 | ); 112 | productName = Example; 113 | productReference = EF2C88AD2943163700A59DB3 /* Example.app */; 114 | productType = "com.apple.product-type.application"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | EF2C88A52943163700A59DB3 /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | BuildIndependentTargetsInParallel = 1; 123 | LastSwiftUpdateCheck = 1410; 124 | LastUpgradeCheck = 1410; 125 | TargetAttributes = { 126 | EF2C88AC2943163700A59DB3 = { 127 | CreatedOnToolsVersion = 14.1; 128 | }; 129 | }; 130 | }; 131 | buildConfigurationList = EF2C88A82943163700A59DB3 /* Build configuration list for PBXProject "Example" */; 132 | compatibilityVersion = "Xcode 14.0"; 133 | developmentRegion = en; 134 | hasScannedForEncodings = 0; 135 | knownRegions = ( 136 | en, 137 | Base, 138 | ); 139 | mainGroup = EF2C88A42943163700A59DB3; 140 | productRefGroup = EF2C88AE2943163700A59DB3 /* Products */; 141 | projectDirPath = ""; 142 | projectRoot = ""; 143 | targets = ( 144 | EF2C88AC2943163700A59DB3 /* Example */, 145 | ); 146 | }; 147 | /* End PBXProject section */ 148 | 149 | /* Begin PBXResourcesBuildPhase section */ 150 | EF2C88AB2943163700A59DB3 /* Resources */ = { 151 | isa = PBXResourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | EF2C88B82943163800A59DB3 /* Preview Assets.xcassets in Resources */, 155 | EF2C88B52943163800A59DB3 /* Assets.xcassets in Resources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXResourcesBuildPhase section */ 160 | 161 | /* Begin PBXSourcesBuildPhase section */ 162 | EF2C88A92943163700A59DB3 /* Sources */ = { 163 | isa = PBXSourcesBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | EFF16671294316C80001B857 /* ColorAsset+Constant.swift in Sources */, 167 | EF2C88B32943163700A59DB3 /* ContentView.swift in Sources */, 168 | EF2C88B12943163700A59DB3 /* ExampleApp.swift in Sources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXSourcesBuildPhase section */ 173 | 174 | /* Begin XCBuildConfiguration section */ 175 | EF2C88B92943163800A59DB3 /* Debug */ = { 176 | isa = XCBuildConfiguration; 177 | buildSettings = { 178 | ALWAYS_SEARCH_USER_PATHS = NO; 179 | CLANG_ANALYZER_NONNULL = YES; 180 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 182 | CLANG_ENABLE_MODULES = YES; 183 | CLANG_ENABLE_OBJC_ARC = YES; 184 | CLANG_ENABLE_OBJC_WEAK = YES; 185 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 186 | CLANG_WARN_BOOL_CONVERSION = YES; 187 | CLANG_WARN_COMMA = YES; 188 | CLANG_WARN_CONSTANT_CONVERSION = YES; 189 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 190 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 191 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 192 | CLANG_WARN_EMPTY_BODY = YES; 193 | CLANG_WARN_ENUM_CONVERSION = YES; 194 | CLANG_WARN_INFINITE_RECURSION = YES; 195 | CLANG_WARN_INT_CONVERSION = YES; 196 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 197 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 198 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 199 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 200 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 201 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 202 | CLANG_WARN_STRICT_PROTOTYPES = YES; 203 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 204 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 205 | CLANG_WARN_UNREACHABLE_CODE = YES; 206 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 207 | COPY_PHASE_STRIP = NO; 208 | DEBUG_INFORMATION_FORMAT = dwarf; 209 | ENABLE_STRICT_OBJC_MSGSEND = YES; 210 | ENABLE_TESTABILITY = YES; 211 | GCC_C_LANGUAGE_STANDARD = gnu11; 212 | GCC_DYNAMIC_NO_PIC = NO; 213 | GCC_NO_COMMON_BLOCKS = YES; 214 | GCC_OPTIMIZATION_LEVEL = 0; 215 | GCC_PREPROCESSOR_DEFINITIONS = ( 216 | "DEBUG=1", 217 | "$(inherited)", 218 | ); 219 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 220 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 221 | GCC_WARN_UNDECLARED_SELECTOR = YES; 222 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 223 | GCC_WARN_UNUSED_FUNCTION = YES; 224 | GCC_WARN_UNUSED_VARIABLE = YES; 225 | IPHONEOS_DEPLOYMENT_TARGET = 16.1; 226 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 227 | MTL_FAST_MATH = YES; 228 | ONLY_ACTIVE_ARCH = YES; 229 | SDKROOT = iphoneos; 230 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 231 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 232 | }; 233 | name = Debug; 234 | }; 235 | EF2C88BA2943163800A59DB3 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | CLANG_ANALYZER_NONNULL = YES; 240 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_ENABLE_OBJC_WEAK = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 257 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 258 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 261 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 262 | CLANG_WARN_STRICT_PROTOTYPES = YES; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 269 | ENABLE_NS_ASSERTIONS = NO; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu11; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 16.1; 280 | MTL_ENABLE_DEBUG_INFO = NO; 281 | MTL_FAST_MATH = YES; 282 | SDKROOT = iphoneos; 283 | SWIFT_COMPILATION_MODE = wholemodule; 284 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 285 | VALIDATE_PRODUCT = YES; 286 | }; 287 | name = Release; 288 | }; 289 | EF2C88BC2943163800A59DB3 /* Debug */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 293 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 294 | CODE_SIGN_STYLE = Automatic; 295 | CURRENT_PROJECT_VERSION = 1; 296 | DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; 297 | DEVELOPMENT_TEAM = ZLQVH78B5Q; 298 | ENABLE_PREVIEWS = YES; 299 | GENERATE_INFOPLIST_FILE = YES; 300 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 301 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 302 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 303 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 304 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 305 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 306 | LD_RUNPATH_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | "@executable_path/Frameworks", 309 | ); 310 | MARKETING_VERSION = 1.0; 311 | PRODUCT_BUNDLE_IDENTIFIER = co.kr.prnd.ColorAsset.Example; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_EMIT_LOC_STRINGS = YES; 314 | SWIFT_VERSION = 5.0; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | }; 317 | name = Debug; 318 | }; 319 | EF2C88BD2943163800A59DB3 /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 324 | CODE_SIGN_STYLE = Automatic; 325 | CURRENT_PROJECT_VERSION = 1; 326 | DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; 327 | DEVELOPMENT_TEAM = ZLQVH78B5Q; 328 | ENABLE_PREVIEWS = YES; 329 | GENERATE_INFOPLIST_FILE = YES; 330 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 331 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 332 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 333 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 334 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 335 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 336 | LD_RUNPATH_SEARCH_PATHS = ( 337 | "$(inherited)", 338 | "@executable_path/Frameworks", 339 | ); 340 | MARKETING_VERSION = 1.0; 341 | PRODUCT_BUNDLE_IDENTIFIER = co.kr.prnd.ColorAsset.Example; 342 | PRODUCT_NAME = "$(TARGET_NAME)"; 343 | SWIFT_EMIT_LOC_STRINGS = YES; 344 | SWIFT_VERSION = 5.0; 345 | TARGETED_DEVICE_FAMILY = "1,2"; 346 | }; 347 | name = Release; 348 | }; 349 | /* End XCBuildConfiguration section */ 350 | 351 | /* Begin XCConfigurationList section */ 352 | EF2C88A82943163700A59DB3 /* Build configuration list for PBXProject "Example" */ = { 353 | isa = XCConfigurationList; 354 | buildConfigurations = ( 355 | EF2C88B92943163800A59DB3 /* Debug */, 356 | EF2C88BA2943163800A59DB3 /* Release */, 357 | ); 358 | defaultConfigurationIsVisible = 0; 359 | defaultConfigurationName = Release; 360 | }; 361 | EF2C88BB2943163800A59DB3 /* Build configuration list for PBXNativeTarget "Example" */ = { 362 | isa = XCConfigurationList; 363 | buildConfigurations = ( 364 | EF2C88BC2943163800A59DB3 /* Debug */, 365 | EF2C88BD2943163800A59DB3 /* Release */, 366 | ); 367 | defaultConfigurationIsVisible = 0; 368 | defaultConfigurationName = Release; 369 | }; 370 | /* End XCConfigurationList section */ 371 | 372 | /* Begin XCSwiftPackageProductDependency section */ 373 | EFF16674294317690001B857 /* ColorAsset */ = { 374 | isa = XCSwiftPackageProductDependency; 375 | productName = ColorAsset; 376 | }; 377 | /* End XCSwiftPackageProductDependency section */ 378 | }; 379 | rootObject = EF2C88A52943163700A59DB3 /* Project object */; 380 | } 381 | --------------------------------------------------------------------------------