<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>m_irie</author_name>
  <author_url>https://blog.hatena.ne.jp/m_irie/</author_url>
  <blog_title>OpenWork Tech Blog</blog_title>
  <blog_url>https://techblog.openwork.co.jp/</blog_url>
  <categories>
    <anon>開発技術</anon>
    <anon>職種別 &gt; ネイティブアプリエンジニア</anon>
  </categories>
  <description>課題 解決策 SwiftUIの仕組み 注意点 最後に iOSエンジニアの入江です。HStack{ }のように宣言的なViewパーツを自作する方法についての投稿です。 課題 複数の画面で、画面のライフサイクルをトリガーとする同じような処理を行う機能（例えばロギングなど）がある場合、UIKitのViewControllerはクラスなので継承が可能です。viewDidLoadなどで共通処理を実装した継承用の基盤クラスを作成し、その基盤クラスを継承することで、簡単に複数の画面で共通処理を実現できます。 しかし、SwiftUIの場合はレイアウト要素の宣言がクラスではなく構造体で書かれるので、継承ができま…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftechblog.openwork.co.jp%2Fentry%2Ffunctional-swiftui&quot; title=&quot;SwiftUIで自作Viewを作成し宣言的に共通処理を行う - OpenWork Tech Blog&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>2024-06-14 10:33:37</published>
  <title>SwiftUIで自作Viewを作成し宣言的に共通処理を行う</title>
  <type>rich</type>
  <url>https://techblog.openwork.co.jp/entry/functional-swiftui</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
