@@ -175,48 +175,3 @@ public struct Feature: Identifiable, Sendable {
175175 . init( title: self . title, image: self . image, message: Text ( key, tableName: tableName, bundle: bundle, comment: comment) )
176176 }
177177}
178- /// Result builder that allows you to freely build Feature structures
179- @available ( iOS 17 . 0 , macOS 14 . 0 , tvOS 17 . 0 , visionOS 1 . 0 , * )
180- /// A result builder to construct onboarding features.
181- @resultBuilder
182- public struct FeatureBuilder {
183- /// Required in resultBuilder
184- /// Combines multiple Features into an array.
185- /// - Parameter parts: A variadic list of Features.
186- /// - Returns: An array of Features.
187- public static func buildBlock( _ parts: Feature ... ) -> Array < Feature > {
188- parts
189- }
190- /// Enable if
191- /// Handles optional Feature arrays.
192- /// - Parameter parts: An optional array of Features.
193- /// - Returns: The first Feature or a default Feature.
194- public static func buildOptional( _ parts: [ Feature ] ? ) -> Feature {
195- parts? . first ?? Feature ( )
196- }
197- /// Enable if-else (first branch)
198- /// - Parameter parts: An array of Features.
199- /// - Returns: The first Feature or a default Feature.
200- public static func buildEither( first parts: [ Feature ] ) -> Feature {
201- parts. first ?? Feature ( )
202- }
203- /// Enable if-else (second branch)
204- /// - Parameter parts: An array of Features.
205- /// - Returns: The first Feature or a default Feature.
206- public static func buildEither( second parts: [ Feature ] ) -> Feature {
207- parts. first ?? Feature ( )
208- }
209- /// Enable for-in
210- /// - Parameter parts: An array of Feature arrays.
211- /// - Returns: The first Feature from the first array or a default Feature.
212- public static func buildArray( _ parts: [ [ Feature ] ] ) -> Feature {
213- parts. first? . first ?? Feature ( )
214- }
215- /// Enable #if
216- /// - Parameter parts: An array of Features.
217- /// - Returns: The array of Features.
218- public static func buildLimitedAvailability( _ parts: [ Feature ] ) -> Array < Feature > {
219- parts
220- }
221- }
222-
0 commit comments