Sha256: ea9f176d839111b908b70735444fed207a43a0483a21a178939ef8dd7a09c97f
Contents?: true
Size: 811 Bytes
Versions: 15
Compression:
Stored size: 811 Bytes
Contents
# @requires MotionKit::NSViewHelpers module MotionKit class NSViewHelpers def constraints(add_to_view=nil, &block) add_to_view ||= target if add_to_view.is_a?(Symbol) add_to_view = self.get_view(add_to_view) end add_to_view.setTranslatesAutoresizingMaskIntoConstraints(false) constraints_target = ConstraintsTarget.new(add_to_view) deferred(constraints_target) do context(constraints_target, &block) constraints_target.apply_all_constraints(self, add_to_view) end end end class Layout def constraints(add_to_view=nil, &block) if has_context? apply(:constraints, add_to_view, &block) else context(self.view) do constraints(add_to_view, &block) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems