Skip to content

0.0.4

Choose a tag to compare

@kylebshr kylebshr released this 29 Mar 22:31
· 23 commits to main since this release

What's New

@binding support

@Binding properties now generate the correct parameter type (Binding<T>) and assignment (self._isOn = isOn) in all generated inits.

@Slots struct Toggle<Label: View>: View {
    @Binding var isOn: Bool
    @Slot(.text) var label: Label
    var body: some View { ... }
}

// Generated:
init(isOn: Binding<Bool>, @ViewBuilder label: () -> Label)
init(isOn: Binding<Bool>, label: LocalizedStringKey)

Internal-state property wrappers are skipped

Properties annotated with @State, @StateObject, @Environment, @EnvironmentObject, @FocusState, @AppStorage, @SceneStorage, and other internal-state wrappers are automatically excluded from generated inits.

Internal

  • Organized Slots source files into separate files