File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change
1
+ import SwiftUI
2
+
3
+ public final class GroupProps : ObservableObject , Decodable {
4
+ @Published public var style : StyleProps ?
5
+
6
+ enum CodingKeys : String , CodingKey {
7
+ case style
8
+ }
9
+
10
+ public required init ( from decoder: Decoder ) throws {
11
+ let container = try decoder. container ( keyedBy: CodingKeys . self)
12
+ style = try container. decodeIfPresent ( StyleProps . self, forKey: . style)
13
+ }
14
+
15
+ public func merge( from other: GroupProps ) {
16
+ style = other. style
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ import SwiftUI
2
+
3
+ public struct GroupView < Content: View > : View {
4
+ @ObservedObject public var props : GroupProps
5
+ let content : ( ) -> Content
6
+
7
+ public init ( props: GroupProps , @ViewBuilder content: @escaping ( ) -> Content ) {
8
+ self . props = props
9
+ self . content = content
10
+ }
11
+
12
+ public var body : some View {
13
+ Group {
14
+ content ( )
15
+ }
16
+ . applyViewStyles ( props. style)
17
+ }
18
+ }
Original file line number Diff line number Diff line change 1
1
import { type PropsWithChildren } from "react" ;
2
2
import { SwiftUIParentIdProvider } from "../contexts" ;
3
3
import { useSwiftUINode } from "../hooks" ;
4
- import type { FunctionComponentWithId } from "../types" ;
4
+ import type { FunctionComponentWithId , NativeViewStyle } from "../types" ;
5
5
6
6
// https://developer.apple.com/documentation/swiftui/form
7
7
8
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
9
- export type NativeGroupProps = { } ;
8
+ export type NativeGroupProps = {
9
+ style ?: NativeViewStyle ;
10
+ } ;
10
11
11
12
export const Group : FunctionComponentWithId < PropsWithChildren < NativeGroupProps > > = ( {
12
13
children,
You can’t perform that action at this time.
0 commit comments