moko-fields icon indicating copy to clipboard operation
moko-fields copied to clipboard

Improve SwiftUI usage

Open Alex009 opened this issue 2 years ago • 2 comments

here snippet with useful api:

struct Binder {
  static func binding(field: FormField<NSString, StringDesc>) -> Binding<String> {
    return Binding(
      get: { String(field.data.value ?? "") },
      set: { field.setValue(value: ($0 as NSString)) }
    }
  }
}

but in this case we not receive updated of FormField on UI. works only UI -> FormField updates. FormField -> UI updated not implemented

Alex009 avatar Jun 12 '23 15:06 Alex009

https://gist.github.com/stakancheck/85013d753dc198db1724140155bac889

Alex009 avatar Jun 12 '23 16:06 Alex009

https://gist.github.com/stakancheck/85013d753dc198db1724140155bac889

The solution has been updated and support for the error state has been added.

stakancheck avatar Jun 30 '23 11:06 stakancheck