Created
October 1, 2019 07:12
-
-
Save gwennguihal/6c68ec340ca89a0a3528e05a0ba9d838 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public struct Map<Data: Collection>: Content { | |
| var data: Data | |
| var mapClosure: (Data.Element) -> Content | |
| public init(_ data: Data, @ContentBuilder _ mapClosure: @escaping (Data.Element) -> Content) { | |
| self.data = data | |
| self.builder = builder | |
| } | |
| public var contents: [Content]? { | |
| return data.map { mapClosure($0) } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment