Hacker News new | ask | show | jobs
by nottombrown 4333 days ago
Here's the source of try from active_support

    def try(*a, &b)
      if a.empty? && block_given?
        yield self
      else
        public_send(*a, &b) if respond_to?(a.first)
      end
    end
https://github.com/rails/rails/blob/d68419a88e424e588c2d8dec...

Should be easy to do the same in swift. Let me take a stab at it.