Skip to content

Commit da39322

Browse files
farkassebPéter Krassay
andauthored
Modify SwiftUI Color extension to extend ShapeStyle (#185)
Co-authored-by: Péter Krassay <[email protected]>
1 parent 94eab4c commit da39322

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/XcodeExport/Resources/Color+extension.swift.stencil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private class BundleProvider {
1313
static let bundle = Bundle(for: BundleProvider.self)
1414
}
1515
{% endif %}
16-
public extension Color {{ "{" }}{% for color in colors %}
16+
public extension ShapeStyle where Self == Color {{ "{" }}{% for color in colors %}
1717
static var {{ color.name }}: Color { Color({% if useNamespace %}"{{ color.originalName }}"{% else %}#function{% endif %}{% if not assetsInMainBundle %}, bundle: BundleProvider.bundle{% endif %}) }{% endfor %}
1818
}
1919
{% include "Bundle+extension.swift.stencil.include" %}

Tests/XcodeExportTests/XcodeColorExporterTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ final class XcodeColorExporterTests: XCTestCase {
237237
static let bundle = Bundle(for: BundleProvider.self)
238238
}
239239
240-
public extension Color {
240+
public extension ShapeStyle where Self == Color {
241241
static var colorPair1: Color { Color(#function) }
242242
static var colorPair2: Color { Color(#function) }
243243
}
@@ -274,7 +274,7 @@ final class XcodeColorExporterTests: XCTestCase {
274274
static let bundle = Bundle.module
275275
}
276276
277-
public extension Color {
277+
public extension ShapeStyle where Self == Color {
278278
static var colorPair1: Color { Color(#function, bundle: BundleProvider.bundle) }
279279
static var colorPair2: Color { Color(#function, bundle: BundleProvider.bundle) }
280280
}

0 commit comments

Comments
 (0)