An extension to the View
protocol that provides conditional view modifiers.
This extension adds methods to SwiftUI's View
type that allow you to conditionally modify the view. These methods are useful for creating more readable and concise view hierarchies in SwiftUI.
You can find the documentation here: https://kevinhermawan.github.io/ViewCondition/documentation/viewcondition
You can add ViewCondition
as a dependency to your project using Swift Package Manager by adding it to the dependencies value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/kevinhermawan/ViewCondition.git", .upToNextMajor(from: "1.0.0"))
]
Alternatively, in Xcode:
- Open your project in Xcode.
- Click on
File
->Swift Packages
->Add Package Dependency...
- Enter the repository URL:
https://github.com/kevinhermawan/ViewCondition.git
- Choose the version you want to add. You probably want to add the latest version.
- Click
Add Package
.