Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ericlewis/swiftui-viewmodifierbuilder

A result builder for ViewModifiers.
https://github.com/ericlewis/swiftui-viewmodifierbuilder

helper ios macos resultbuilder swift swiftui tvos utility viewmodifier watchos

Last synced: 2 months ago
JSON representation

A result builder for ViewModifiers.

Awesome Lists containing this project

README

        

# ViewModifierBuilder

[![](https://img.shields.io/badge/Swift_Package_Manager-compatible-ed702d.svg?style=flat)](https://github.com/apple/swift-package-manager)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fericlewis%2Fswiftui-viewmodifierbuilder%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ericlewis/ViewModifierBuilder)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fericlewis%2Fswiftui-viewmodifierbuilder%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ericlewis/ViewModifierBuilder)

A [result builder](https://github.com/apple/swift-evolution/blob/main/proposals/0289-result-builders.md) for [ViewModifiers](https://developer.apple.com/documentation/swiftui/viewmodifier/).

## Example
```swift
import SwiftUI
import ViewModifierBuilder

struct ContentView: View {

@State
private var toggler = false

var body: some View {
VStack {
Button("Toggle Modifier") {
toggler.toggle()
}
}
.modifiers {
CustomModifier1()
CustomModifier2()
if toggler {
CustomModifier3()
}
}
}
}

```