- August 12, 2025
- Mins Read
✨ Super sweet syntactic sugar for SwiftUI.View initializers.
struct BorderTextView: View {
var color: Color?
@ViewBuilder
var body: some View {
Text(“Hello”)
.if(let: color) {
$0.border($1)
}
}
}
This is equivalent to:
struct BorderTextView: View {
var color: Color?
@ViewBuilder
var body: some View {
let text = Text(“Hello”)
if let color = color {
text.border(color) // border doesn’t allow optional
} else {
text
}
}
}
let color: Color?
Text(“Hello”)
.if(let: color) {
$0.border($1)
}
let text = “”
Text(“Hello”)
.if(text == “Hello”) {
$0.bold()
}
let text = “”
Text(“Hello”)
.ifNot(text == “Hello”) {
$0.bold()
}
let text = “”
Text(“Hello”)
.then {
if text == “Hello” {
$0.bold()
} else {
$0.italic()
}
}
If you don’t return view in else
, the view may not come out.
Using Swift Pacage Manager:
import PackageDescription
let package = Package(
name: “MyAwesomeApp”,
dependencies: [
.package(url: “https://github.com/tokijh/ViewCondition.git”, from: “1.0.0”)
]
)
Recognize your user's voice elegantly without having to figure out authorization and audio engines. SwiftSpeech Examples Features Installation Getting Started ...
Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 14.0 Installation ...
SlidingRuler is a Swift package containing a SwiftUI control that acts like an linear infinite slider or a finite, more precise ...
SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and ...