@@ -66,10 +66,10 @@ public struct Button : View, ListItemAdapting {
66
66
}
67
67
68
68
// SKIP @bridge
69
- public init ( bridgedLabel : any View , action: @escaping ( ) -> Void ) {
70
- self . label = ComposeBuilder . from { bridgedLabel }
69
+ public init ( bridgedRole : Int ? , action: @escaping ( ) -> Void , bridgedLabel : any View ) {
70
+ self . role = bridgedRole == nil ? nil : ButtonRole ( rawValue : bridgedRole! )
71
71
self . action = action
72
- self . role = nil
72
+ self . label = ComposeBuilder . from { bridgedLabel }
73
73
}
74
74
75
75
#if SKIP
@@ -194,11 +194,11 @@ public struct ButtonStyle: RawRepresentable, Equatable {
194
194
self . rawValue = rawValue
195
195
}
196
196
197
- public static let automatic = ButtonStyle ( rawValue: 0 )
198
- public static let plain = ButtonStyle ( rawValue: 1 )
199
- public static let borderless = ButtonStyle ( rawValue: 2 )
200
- public static let bordered = ButtonStyle ( rawValue: 3 )
201
- public static let borderedProminent = ButtonStyle ( rawValue: 4 )
197
+ public static let automatic = ButtonStyle ( rawValue: 0 ) // For bridging
198
+ public static let plain = ButtonStyle ( rawValue: 1 ) // For bridging
199
+ public static let borderless = ButtonStyle ( rawValue: 2 ) // For bridging
200
+ public static let bordered = ButtonStyle ( rawValue: 3 ) // For bridging
201
+ public static let borderedProminent = ButtonStyle ( rawValue: 4 ) // For bridging
202
202
}
203
203
204
204
public enum ButtonRepeatBehavior : Hashable {
@@ -207,20 +207,25 @@ public enum ButtonRepeatBehavior : Hashable {
207
207
case disabled
208
208
}
209
209
210
- public enum ButtonRole : Equatable {
211
- case destructive
212
- case cancel
210
+ public enum ButtonRole : Int , Equatable {
211
+ case destructive = 1 // For bridging
212
+ case cancel = 2 // For bridging
213
213
}
214
214
215
215
extension View {
216
- public func buttonStyle( _ style: ButtonStyle ) -> some View {
216
+ public func buttonStyle( _ style: ButtonStyle ) -> any View {
217
217
#if SKIP
218
218
return environment ( \. _buttonStyle, style)
219
219
#else
220
220
return self
221
221
#endif
222
222
}
223
223
224
+ // SKIP @bridge
225
+ public func buttonStyle( bridgedStyle: Int ) -> any View {
226
+ return buttonStyle ( ButtonStyle ( rawValue: bridgedStyle) )
227
+ }
228
+
224
229
@available ( * , unavailable)
225
230
public func buttonRepeatBehavior( _ behavior: ButtonRepeatBehavior ) -> some View {
226
231
return self
0 commit comments