Skip to content

Commit

Permalink
Modify SwiftUI Color extension to extend ShapeStyle (#185)
Browse files Browse the repository at this point in the history
Co-authored-by: Péter Krassay <[email protected]>
  • Loading branch information
farkasseb and Péter Krassay authored Aug 13, 2022
1 parent 94eab4c commit da39322
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private class BundleProvider {
static let bundle = Bundle(for: BundleProvider.self)
}
{% endif %}
public extension Color {{ "{" }}{% for color in colors %}
public extension ShapeStyle where Self == Color {{ "{" }}{% for color in colors %}
static var {{ color.name }}: Color { Color({% if useNamespace %}"{{ color.originalName }}"{% else %}#function{% endif %}{% if not assetsInMainBundle %}, bundle: BundleProvider.bundle{% endif %}) }{% endfor %}
}
{% include "Bundle+extension.swift.stencil.include" %}
4 changes: 2 additions & 2 deletions Tests/XcodeExportTests/XcodeColorExporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ final class XcodeColorExporterTests: XCTestCase {
static let bundle = Bundle(for: BundleProvider.self)
}
public extension Color {
public extension ShapeStyle where Self == Color {
static var colorPair1: Color { Color(#function) }
static var colorPair2: Color { Color(#function) }
}
Expand Down Expand Up @@ -274,7 +274,7 @@ final class XcodeColorExporterTests: XCTestCase {
static let bundle = Bundle.module
}
public extension Color {
public extension ShapeStyle where Self == Color {
static var colorPair1: Color { Color(#function, bundle: BundleProvider.bundle) }
static var colorPair2: Color { Color(#function, bundle: BundleProvider.bundle) }
}
Expand Down

0 comments on commit da39322

Please sign in to comment.