๐Ÿ”ฐinit Binding

SwiftUI โŸฉ Data Flow โŸฉ Binding โŸฉ init

// custom control
struct SlidersForSize: View {
    @Binding var size: CGSize    // โญ๏ธ Binding variable
    var body: some View { ... }
}

extension SlidersForSize {
    init(_ size: Binding<CGSize>) {
        self._size = size        // โญ๏ธ ๆณจๆ„๏ผšไธๆ˜ฏ `self.size = size` โ—๏ธโ—๏ธโ—๏ธ
    }
}

Last updated