<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>FromAtom</author_name>
  <author_url>https://blog.hatena.ne.jp/FromAtom/</author_url>
  <blog_title>文字っぽいの。</blog_title>
  <blog_url>https://fromatom.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>Comparable#clamp という便利メソッドを知った。 blog.bigbinary.com いままではこう書いていた let number = 100 let lowerLimit = 0 let upperLimit = 20 min(max(lowerLimit, number), upperLimit) // =&gt; 20 Swiftにもほしいと思って調べたけど、Rangeの clapmped ってのだけ出てきて見つからなかったので書いてみた。 extension Comparable { func clamp(to limits: ClosedRange&lt;Self&gt;) -&gt; S…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ffromatom.hatenablog.com%2Fentry%2F2018%2F05%2F09%2F182055&quot; title=&quot;Comparable#clampがSwiftにも欲しいので作った - 文字っぽいの。&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-05-09 18:20:55</published>
  <title>Comparable#clampがSwiftにも欲しいので作った</title>
  <type>rich</type>
  <url>https://fromatom.hatenablog.com/entry/2018/05/09/182055</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
