<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>llcc</author_name>
  <author_url>https://blog.hatena.ne.jp/llcc/</author_url>
  <blog_title>しめ鯖日記</blog_title>
  <blog_url>https://llcc.hatenablog.com/</blog_url>
  <categories>
    <anon>iOS</anon>
  </categories>
  <description>Swiftで擬似マクロ Swiftファイルではマクロを定義する事ができません。 同様の事をしたい場合は下のようにclassの外に変数を定義します。 もちろん他のSwiftファイルからも参照できます。 グローバル変数となるのであまり使いたくないですが。 let MACRO = &quot;aaa&quot; class MyClass { func method() { print(MACRO) // → aaa } } 引数付きのマクロと同様の事をしたい場合は下のようにメソッドを定義します。 func MACRO(value: String) -&gt; String { return value + &quot;+++&quot; } …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fllcc.hatenablog.com%2Fentry%2F2015%2F06%2F23%2F234417&quot; title=&quot;SwiftでObjective-cのマクロのような事を実現する - しめ鯖日記&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>2015-06-23 23:44:17</published>
  <title>SwiftでObjective-cのマクロのような事を実現する</title>
  <type>rich</type>
  <url>https://llcc.hatenablog.com/entry/2015/06/23/234417</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
