Skip to content

Instantly share code, notes, and snippets.

@MihaelIsaev
MihaelIsaev / Bindings.swift
Created June 14, 2019 02:51 — forked from AliSoftware/Bindings.swift
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
// This is a re-implementation of the @Binding and @State property wrappers from SwiftUI
// The only purpose of this code is to implement those wrappers myself just to understand how they work internally and why they are needed
// Re-implementing them myself has helped me understand the whole thing better
//: # A Binding is just something that encapsulates getter+setter to a property
@propertyDelegate
struct XBinding<Value> {
var value: Value {
get { return getValue() }