-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a68ef1a
commit ba7eb20
Showing
22 changed files
with
854 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// Copyright (c) Nathan Tannar | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension Group where Content: View { | ||
|
||
@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Please use the built in Group(subviewsOf: ...) init") | ||
@available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Please use the built in Group(subviewsOf: ...) init") | ||
@available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Please use the built in Group(subviewsOf: ...) init") | ||
@available(watchOS, introduced: 6.0, deprecated: 100000.0, message: "Please use the built in Group(subviewsOf: ...) init") | ||
@available(visionOS, introduced: 1.0, deprecated: 100000.0, message: "Please use the built in Group(subviewsOf: ...) init") | ||
public init<V: View, Result: View>( | ||
subviewsOf view: V, | ||
@ViewBuilder transform: @escaping (VariadicView<V>) -> Result | ||
) where Content == VariadicViewAdapter<V, Result> { | ||
self.init { | ||
VariadicViewAdapter(source: view, content: transform) | ||
} | ||
} | ||
} | ||
|
||
|
||
// MARK: - Previews | ||
|
||
struct Group_Previews: PreviewProvider { | ||
static var previews: some View { | ||
Group { | ||
Group(subviewsOf: Content()) { source in | ||
VStack { | ||
HStack { | ||
source[0] | ||
source[1] | ||
} | ||
|
||
source[2...] | ||
} | ||
} | ||
.previewDisplayName("subviewsOf") | ||
} | ||
} | ||
|
||
struct Content: View { | ||
var body: some View { | ||
Section { | ||
Text("Line 1") | ||
Text("Line 2") | ||
Text("Line 3") | ||
Text("Line 4") | ||
Text("Line 5") | ||
} header: { | ||
Text("Header") | ||
} footer: { | ||
Text("Footer") | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.