Skip to content

Releases: mgdgc/Viewrito

0.0.2

27 May 14:23
Compare
Choose a tag to compare
  1. Viewrito's initializer has changed.
  2. In both the Viewrito and .addViewModifier view modifiers, if the closure returns an empty view, it just shows the original view.

0.0.1

26 May 06:05
Compare
Choose a tag to compare

Usage

Viewrito {
    TextField("", text: $text)
} returning: { textField in
    if #available(iOS 17, *) {
        textField
            .onChange(of: text) { old, new in
                print("\(old) -> \(new)")
            }
    } else {
        textField
            .onChange(of: text) { new in
                print("\(new)")
            }
    }
}

or

TextField("", text: $text)
    .addViewModifier {
        if #available(iOS 17, *) {
            $0.onChange(of: text) { old, new in
                print("\(old) -> \(new)")
            }
        }
    }