ObservationBP wraps swift-percetion for a better code indentation
User ViewBP
protocol and bodyBP
instead of WithPerceptionTracking
import ObservationBP
import SwiftUI
@Perceptible
final class Person {
var name: String
var age: Int
init(name: String, age: Int) {
self.name = name
self.age = age
}
}
struct ContentView: ViewBP {
var person: Person = Person(name: "name", age: 1)
var bodyBP: some View {
VStack {
Text("Hello, \(person.name)")
}
}
}
use the wrapper for Objective-C classes
Great backporting of Observation framework swift-perception