File tree Expand file tree Collapse file tree
Sources/ThemeKitGenerator
Tests/ThemeKitGeneratorTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ nonisolated public struct ShapeStyleExtensionGenerator: Sendable {
1313 import SwiftUI
1414 import ThemeKit
1515
16- extension ShapeStyle where Self == ThemeShapeStyle< \( category. styleType) > {
16+ nonisolated extension ShapeStyle where Self == ThemeShapeStyle< \( category. styleType) > {
1717 \( staticProperties)
1818 }
1919
@@ -26,7 +26,7 @@ nonisolated public struct ShapeStyleExtensionGenerator: Sendable {
2626
2727 content += """
2828
29- extension ShapeStyle {
29+ nonisolated extension ShapeStyle {
3030 \( instanceProperties)
3131 }
3232
Original file line number Diff line number Diff line change @@ -152,6 +152,25 @@ struct ThemeFileGeneratorTests {
152152 #expect( gradientsExt. content. contains ( " ThemeShapeStyle<Gradient> " ) )
153153 }
154154
155+ @Test func shapeStyleExtension_usesNonisolated( ) throws {
156+ let files = try ThemeFileGenerator ( ) . generate ( fromJSON: fullJSON) . files
157+
158+ let colorsExt = try #require( files. first { $0. name == " ShapeStyle+ThemeColors.swift " } )
159+ #expect( colorsExt. content. contains ( " nonisolated extension ShapeStyle " ) )
160+
161+ let gradientsExt = try #require( files. first { $0. name == " ShapeStyle+ThemeGradients.swift " } )
162+ #expect( gradientsExt. content. contains ( " nonisolated extension ShapeStyle " ) )
163+ }
164+
165+ @Test func shadowShapeStyleExtension_bothBlocksUseNonisolated( ) throws {
166+ let files = try ThemeFileGenerator ( ) . generate ( fromJSON: shadowsOnlyJSON) . files
167+ let shadowExt = try #require( files. first { $0. name == " ShapeStyle+ThemeShadows.swift " } )
168+
169+ // Both the constrained static extension and unconstrained instance extension must be nonisolated
170+ let matches = shadowExt. content. components ( separatedBy: " nonisolated extension ShapeStyle " )
171+ #expect( matches. count == 3 , " Expected two 'nonisolated extension ShapeStyle' occurrences (splits into 3 parts) " )
172+ }
173+
155174 @Test func copyWith_themeUsesOptionalParams( ) throws {
156175 let files = try ThemeFileGenerator ( ) . generate ( fromJSON: fullJSON) . files
157176 let copyWith = try #require( files. first { $0. name == " Theme+CopyWith.swift " } )
You can’t perform that action at this time.
0 commit comments