Skip to content

Releases: mgdgc/Viewrito

Release list

0.0.2

Choose a tag to compare

@mgdgc mgdgc released this 27 May 14:23
  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

Choose a tag to compare

@mgdgc mgdgc released this 26 May 06:05

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)")
            }
        }
    }