function binding = bind(source, sourceParameter, destination, destinationParameter, varargin)
    %BIND Connects a source object property to a destination object
    %property or method
    %   Use BIND to connect a source object property (that has attribute
    %   SetObservable=true) to a destination object property so that
    %   whenever the source property value is changed the parameter
    %   property value is updated to match.
    %
    %   BIND(source, sourceParameter, destination, destinationParameter)
    %   connects the source parameter (property) of the source object to
    %   the destination parameter (property or method) of the destination
    %   object.
    %
    %   BIND(___,Name=Value) connects the source and destination objects
    %   using one or more name-value arguments.
    %       Name-Value Arguments:
    %
    %           Enabled - controls if the binding is active or inactive
    %
    %   binding = BIND(___) returns a binding object that represents the
    %   connection between the source and destination. Use delete(binding)
    %   to remove the connection.

    %   Copyright 2022-2023 The MathWorks, Inc.
    
    arguments
        source (1,1) {mustBeA(source,'handle')}
        sourceParameter char
        destination (1,1) {mustBeA(destination,'handle')}
        destinationParameter char 
    end
    arguments (Repeating)
        varargin
    end

    try
        lifecycleController =  matlab.lang.internal.bind.BindingLifecycleControllerManager.Instance.LifecycleController;
        binding = lifecycleController.createBinding(source, sourceParameter, destination, destinationParameter, varargin{:});
    catch ex
        throwAsCaller(ex);
    end
end

