PageSourceSearch

https://shinagawa.app/_next/static/chunks/pages/posts/ios_share_extension-03faf6af85647b58.js

js shinagawa.app collected 2026-10-02 01:16:00 UTC 72,013 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8165],{8893:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/posts/ios_share_extension",function(){return n(9839)}])},5772:function(e,s,n){"use strict";let o=e=>{let{src:s,width:n}=e;return s};s.Z=o},8177:function(e,s,n){"use strict";var o=n(5893),t=n(1857),i=n.n(t);let r=new Date().getFullYear();s.Z={footer:(0,o.jsxs)("small",{style:{display:"block",marginTop:"8rem"},className:"jsx-7c359fde634f3543",children:[(0,o.jsx)("time",{className:"jsx-7c359fde634f3543",children:r})," \xa9 品川アプリ.",(0,o.jsx)("a",{href:"/feed.xml",className:"jsx-7c359fde634f3543",children:"RSS"}),(0,o.jsx)(i(),{id:"7c359fde634f3543",children:"a.jsx-7c359fde634f3543{float:right}@media screen and (max-width:480px){article.jsx-7c359fde634f3543{padding-top:2rem;padding-bottom:4rem}}"})]}),head:e=>{let{title:s,meta:n}=e;return(0,o.jsxs)(o.Fragment,{children:[n.description&&(0,o.jsx)("meta",{name:"description",content:n.description}),n.tag&&(0,o.jsx)("meta",{name:"keywords",content:n.tag}),n.author&&(0,o.jsx)("meta",{name:"author",content:n.author})]})},readMore:"Read More →",darkMode:!0}},9839:function(e,s,n){"use strict";n.r(s),n.d(s,{__toc:function(){return v},default:function(){return g}});var o=n(5893),t=n(2673),i=n(8473),r=n(8177);n(7707);var a=n(2643),l=n(757),c=n.n(l),d=n(5675),h=n.n(d),p=n(5772),x={src:"/_next/static/media/screen1.a5f40a2a.png",height:640,width:296,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAICAMAAADp7a43AAAACVBMVEX4+fnx8fDt6urXBw4sAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGElEQVR4nGNgQABGRjgB4jIxMUK5TEwMAAD0ABH98EjjAAAAAElFTkSuQmCC",blurWidth:4,blurHeight:8},k={src:"/_next/static/media/screen2.461ecc71.png",height:640,width:296,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAICAMAAADp7a43AAAAHlBMVEXb3N37+vvU09Pp6uzy8/PS1t3g6ubt8u319fXJxMfvnWKLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAJElEQVR4nEXBwQEAIAjEsPZA0f0X9mkCXxKq5lB7XXp2UMXWBwVFAFGAHaqpAAAAAElFTkSuQmCC",blurWidth:4,blurHeight:8},y={src:"/_next/static/media/screen3.eda43f6e.png",height:640,width:296,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAICAMAAADp7a43AAAAFVBMVEXv8PP4+fj09ff8/P3s7O/m5+rU3vJiT0H2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIklEQVR4nAXBgQEAIAgDIDa1/08OtGVmIk10VYi8V+6OXR8E7gBG8L1SBgAAAABJRU5ErkJggg==",blurWidth:4,blurHeight:8},j={src:"/_next/static/media/info_plist.76b64df3.png",height:434,width:1184,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAADCAMAAACZFr56AAAAFVBMVEUwJB49P0Y3OD41Li0wKCZAOThOUFfELnkpAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAH0lEQVR4nGNgZmJhAANWVmZmZlZmFgZGNkYmJkZGJgAC9AA5sSD3HwAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:3},u={src:"/_next/static/media/url_types.ad36ebd8.png",height:1024,width:2126,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAMAAACEE47CAAAABlBMVEUvJCA1LizckWpiAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAGUlEQVR4nGNgZGRkAAM4A8yE8BgZGRgZGAABLgAQ4oCtowAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:4};let v=[{depth:2,value:"概要",id:"概要"},{depth:2,value:"Share extensions と Action extension のどちらを使うか",id:"share-extensions-と-action-extension-のどちらを使うか"},{depth:2,value:"動作の流れ",id:"動作の流れ"},{depth:2,value:"Containing app の実装",id:"containing-app-の実装"},{depth:3,value:"1. Custom URL Scheme を設定する",id:"1-custom-url-scheme-を設定する"},{depth:3,value:"2. SwiftUI で onOpenURL イベントをハンドリングする",id:"2-swiftui-で-onopenurl-イベントをハンドリングする"},{depth:2,value:"Share Extension の実装",id:"share-extension-の実装"},{depth:3,value:"1. Share Extension を Target に追加",id:"1-share-extension-を-target-に追加"},{depth:3,value:"2. ShareViewController.swift を書き換える",id:"2-shareviewcontrollerswift-を書き換える"},{depth:3,value:"3. ShareView.swift を作成",id:"3-shareviewswift-を作成"},{depth:3,value:"4. UIApplication+.swift を作成",id:"4-uiapplicationswift-を作成"},{depth:3,value:"5. Info.plist の設定",id:"5-infoplist-の設定"},{depth:2,value:"参考",id:"参考"}];function m(e){let s=Object.assign({h2:"h2",p:"p",a:"a",blockquote:"blockquote",ol:"ol",li:"li",h3:"h3",ul:"ul",pre:"pre",code:"code",span:"span"},(0,a.a)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.h2,{id:"概要",children:"概要"}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.a,{href:"https://apps.apple.com/jp/app/%E5%B0%8F%E8%AA%AC%E3%82%92%E8%81%9E%E3%81%93%E3%81%86/id1061686382",children:"小説を聞こう"}),"の iOS アプリに Share Extension を導入し、Safari からアプリを開く機能を実装しました。\n今回はその実装方法を説明します。"]}),"\n",(0,o.jsx)(s.h2,{id:"share-extensions-と-action-extension-のどちらを使うか",children:"Share extensions と Action extension のどちらを使うか"}),"\n",(0,o.jsx)(s.p,{children:"Safari からアプリを開く機能を実装するには、Share extension と Action extension のどちらかを使えばよさそうです。\nApple のヒューマンインターフェースガイドラインに、使い分けの記載がありました。"}),"\n",(0,o.jsx)(s.p,{children:(0,o.jsx)(s.a,{href:"https://developer.apple.com/design/human-interface-guidelines/components/menus-and-actions/activity-views#share-and-action-extensions/",children:"Share and action extensions"})}),"\n",(0,o.jsxs)(s.blockquote,{children:["\n",(0,o.jsx)(s.p,{children:"Share extensions give people a convenient way to share information from the current context with apps, social media accounts, and other services. Action extensions let people initiate content-specific tasks — like adding a bookmark, copying a link, editing an inline image, or displaying selected text in another language — without leaving the current context."}),"\n"]}),"\n",(0,o.jsxs)(s.blockquote,{children:["\n",(0,o.jsx)(s.p,{children:"Share extension は、現在のコンテクストからアプリケーション、ソーシャルメディアアカウント、その他のサービスと情報を共有するための便利な方法を提供します。Action extension では、ブックマークの追加、リンクのコピー、インライン画像ã
1®ç·¨é›†ã€é¸æŠžã—たテキストの別言語表示など、コンテンツ固有のタスクを、現在のコンテキストを離れることなく開始することができます。"}),"\n"]}),"\n",(0,o.jsx)(s.p,{children:"今回は Safari からアプリを開く機能を実装するので、Share extension を使うことにしました。"}),"\n",(0,o.jsx)(s.h2,{id:"動作の流れ",children:"動作の流れ"}),"\n",(0,o.jsxs)(s.ol,{children:["\n",(0,o.jsx)(s.li,{children:"Host app(Safari)の共有ボタンをタップ > Containing app(小説を聞こう)をタップ。"}),"\n"]}),"\n",(0,o.jsxs)("div",{className:c().screenshots,children:[(0,o.jsx)(h(),{loader:p.Z,src:x,width:180}),(0,o.jsx)(h(),{loader:p.Z,src:k,width:180})]}),"\n",(0,o.jsxs)(s.ol,{start:"2",children:["\n",(0,o.jsx)(s.li,{children:"Share Extension は Host app の URL を取得し、Custom URL Scheme で Containing app を開く。その時、Host app の URL は エンコードして Custom URL Scheme のホスト部に指定する(例: listen-to-novels://https%3A%2F%2Fwww.google.com)"}),"\n",(0,o.jsx)(s.li,{children:"Containing app は Custom URL Scheme のホスト部を デコードして、その URL を WebView で表示する。"}),"\n"]}),"\n",(0,o.jsx)("div",{className:c().screenshots,children:(0,o.jsx)(h(),{loader:p.Z,src:y,width:180})}),"\n",(0,o.jsx)(s.h2,{id:"containing-app-の実装",children:"Containing app の実装"}),"\n",(0,o.jsx)(s.h3,{id:"1-custom-url-scheme-を設定する",children:"1. Custom URL Scheme を設定する"}),"\n",(0,o.jsx)(s.p,{children:"Target > Info > URL Types に以下のように入力してください。"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsx)(s.li,{children:"Identifier: $(PRODUCT_BUNDLE_IDENTIFIER)"}),"\n",(0,o.jsx)(s.li,{children:"URL Scheme: 任意で他のアプリと重複しない文字列"}),"\n",(0,o.jsx)(s.li,{children:"Icon: None"}),"\n",(0,o.jsx)(s.li,{children:"Role: Editor"}),"\n"]}),"\n",(0,o.jsx)(h(),{loader:p.Z,src:u}),"\n",(0,o.jsx)(s.h3,{id:"2-swiftui-で-onopenurl-イベントをハンドリングする",children:"2. SwiftUI で onOpenURL イベントをハンドリングする"}),"\n",(0,o.jsx)(s.p,{children:"メインの WindowGroup 直下のビューに onOpenURL 修飾子を指定します。\nその中で、Custom URL Scheme のホスト部に指定された URL を開く処理を実装します。"}),"\n",(0,o.jsx)(s.pre,{"data-language":"swift","data-theme":"default",filename:"ListenToNovelsApp.swift",children:(0,o.jsxs)(s.code,{"data-language":"swift","data-theme":"default",children:[(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@main"})}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ListenToNovelsApp"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"App "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"{"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"var"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" body: "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"some"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" Scene {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"WindowGroup"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"RootView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"}
1,children:"()"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"                ."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"onOpenURL"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"perform"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" { url "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"in"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// url.hostにURLをパーセントエンコードした文字列が入っているので、デコードしてURLを開く"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"if"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" host "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" url.host,"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                       "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" urlString "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" host.removingPercentEncoding {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// URLをWebViewで開く処理"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                        self.store.dispatch"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"MainAction.GoToNovelPage"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"url"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" urlString"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"))"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                    }"})}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"                }"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})})]})}),"\n",(0,o.jsx)(s.h2,{id:"share-extension-の実装",children:"Share Extension の実装"}),"\n",(0,o.jsx)(s.h3,{id:"1-share-extension-を-target-に追加",children:"1. Share Extension を Target に追加"}),"\n",(0,o.jsx)(s.p,{children:"File > New > Target... から Share Extension を選択。"}
1),"\n",(0,o.jsx)(s.p,{children:"Product Name は「ShareExtension」にしました。"}),"\n",(0,o.jsx)(s.h3,{id:"2-shareviewcontrollerswift-を書き換える",children:"2. ShareViewController.swift を書き換える"}),"\n",(0,o.jsx)(s.p,{children:"Host app から渡された URL を取得し、Custom URL Scheme で Containing app を開く処理を実装します。"}),"\n",(0,o.jsx)(s.pre,{"data-language":"swift","data-theme":"default",filename:"ShareViewController.swift",children:(0,o.jsxs)(s.code,{"data-language":"swift","data-theme":"default",children:[(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"SwiftUI"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"UniformTypeIdentifiers"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ShareViewController"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"UIHostingController"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"<"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ShareView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:">"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"enum"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ShareError"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"Error"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"{"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"case"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" cancel"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"required"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"init?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"coder"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:": NSCoder) {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        super."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"init"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"coder"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"}
1,children:" coder, rootView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" ShareView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"())"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"func"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"viewDidLoad"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        super."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"viewDidLoad"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"()"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Task"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"_"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"await"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"openAppWithUrl"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"()"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"func"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"viewDidAppear"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-parameter)"},children:"animated"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:": "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"Bool"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        super."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"viewDidAppear"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"animated"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        extensionContext"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"completeRequest"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"returningItems"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"nil"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"private"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"func"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"openAppWithUrl"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"}
1,children:"() "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"async"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"->"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"Bool"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" item "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" extensionContext"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:".inputItems."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"first"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"as?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" NSExtensionItem,"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"              "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" itemProvider "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" item.attachments"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"first"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"false"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" }"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" itemProvider."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"hasItemConformingToTypeIdentifier"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"UTType."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"url"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:".identifier"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"false"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" }"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"do"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" data "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"try"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"await"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" itemProvider."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"loadItem"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"forTypeIdentifier"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" UTType."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"url"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:".identifier, options"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"nil"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// URLをパーセントエンコードし、Custom URL Schemeのホスト部に指定してopenURLでアプリを開く"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" url "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" data "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"as?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" NSURL,"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"                  "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" encodedUrl "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" url.absoluteString"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"addingPercentEncoding"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"withAllowedCharacters"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" .urlHostAllowed"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:","})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"                  "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" openAppUrl "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"URL"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"string"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"listen-to-novels://'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:"\\(encodedUrl)"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"false"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" }"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"await"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" UIApplication."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"sharedApplication"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"}
1,children:"()"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"open"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"openAppUrl"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        } "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"catch"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"error"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"print"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"error"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"false"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,o.jsx)(s.h3,{id:"3-shareviewswift-を作成",children:"3. ShareView.swift を作成"}),"\n",(0,o.jsx)(s.p,{children:"このクラスは SwiftUI で UI を構築するためにありますが、今回は UI は使わないので、body に EmptyView()を指定します。"}),"\n",(0,o.jsx)(s.pre,{"data-language":"swift","data-theme":"default",filename:"ShareView.swift",children:(0,o.jsxs)(s.code,{"data-language":"swift","data-theme":"default",children:[(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"SwiftUI"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"struct"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ShareView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"View "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"{"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"var"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" body: "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"some"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" View {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"EmptyView"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"}
1,children:"()"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// UIが必要な場合はここに書く"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// https://qiita.com/mume/items/61091237085d9948724c"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,o.jsx)(s.h3,{id:"4-uiapplicationswift-を作成",children:"4. UIApplication+.swift を作成"}),"\n",(0,o.jsx)(s.p,{children:"Share extension から openURL メソッドを呼び出すための黒魔術を書きます。"}),"\n",(0,o.jsx)(s.pre,{"data-language":"swift","data-theme":"default",filename:"UIApplication+.swift",children:(0,o.jsxs)(s.code,{"data-language":"swift","data-theme":"default",children:[(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"UIKit"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"extension"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"UIApplication"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// https://stackoverflow.com/a/36925156/4791194"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"static"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"func"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"sharedApplication"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"->"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" UIApplication {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" UIApplication."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"responds"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"to"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:":"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:" Selector"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"sharedApplication"'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:")"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"))"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"fatalError"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"UIApplication.sharedKeyboardApplication(): `UIApplication` does not respond to selector `sharedApplication`."'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"}
1,children:" unmanagedSharedApplication "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" UIApplication."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"perform"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Selector"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"sharedApplication"'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:")"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"))"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"fatalError"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"UIApplication.sharedKeyboardApplication(): `UIApplication.sharedApplication()` returned `nil`."'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"guard"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"let"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" sharedApplication "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" unmanagedSharedApplication."}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"takeUnretainedValue"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"()"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"as?"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" UIApplication "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"else"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"            "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"fatalError"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"UIApplication.sharedKeyboardApplication(): `UIApplication.sharedApplication()` returned not `UIApplication` instance."'}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(s.span,{className:"line",children:[(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" sharedApplication"})]}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,o.jsx)(s.span,{className:"line",children:(0,o.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,o.jsx)(s.h3,{id:"5-infoplist-の設定",children:"5. Info.plist の設定"}),"\n",(0,o.jsxs)(s.ol,{children:["\n",(0,o.jsx)(s.li,{children:"NSExtensionActivationRule の Type を Dictionary にå
1¤‰æ›´ã—ます。"}),"\n",(0,o.jsx)(s.li,{children:"その下に NSExtensionActivationSupportsWebURLWithMaxCount を追加します。"}),"\n"]}),"\n",(0,o.jsx)(h(),{loader:p.Z,src:j}),"\n",(0,o.jsx)(s.h2,{id:"参考",children:"参考"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsxs)(s.li,{children:["Android 版の実装は",(0,o.jsx)(s.a,{href:"/posts/android_share_activity",children:"こちら"})]}),"\n",(0,o.jsx)(s.li,{children:(0,o.jsx)(s.a,{href:"https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW1",children:"Creating an App Extension"})}),"\n",(0,o.jsx)(s.li,{children:(0,o.jsx)(s.a,{href:"https://qiita.com/mume/items/61091237085d9948724c",children:"SwiftUI で Share Extension を実装する"})}),"\n",(0,o.jsx)(s.li,{children:(0,o.jsx)(s.a,{href:"https://zenn.dev/usk2000/articles/cc8184ed619da3b37b02",children:"[SwiftUI]Deep Link で値を受け取り画面を出し分けする"})}),"\n",(0,o.jsx)(s.li,{children:(0,o.jsx)(s.a,{href:"https://stackoverflow.com/questions/28661062/how-do-you-create-a-share-extension-in-ios8-without-a-share-ui#comment131311590_28661376",children:"How do you create a Share Extension in iOS8 without a share UI"})}),"\n"]})]})}let f={MDXContent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,a.a)(),e.components);return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(m,{...e})}):m(e)},pageOpts:{filePath:"pages/posts/ios_share_extension.mdx",route:"/posts/ios_share_extension",frontMatter:{title:"iOS の Share Extensionで Safari からアプリを開く",date:"2023/2/9",description:"iOS アプリに Share Extension を導入し、Safari からアプリを開く方法を説明します。",tag:"iOS, Share Extension, Safari",author:"kyamada"},timestamp:1737168189e3,pageMap:[{kind:"MdxPage",name:"about",route:"/about",frontMatter:{type:"page",title:"About",date:"2022-07-24T00:00:00.000Z"}},{kind:"Folder",name:"eigovision",route:"/eigovision",children:[{kind:"MdxPage",name:"core-nlp-en",route:"/eigovision/core-nlp-en",frontMatter:{type:"tag",date:"2024-12-04T00:00:00.000Z"}},{kind:"MdxPage",name:"core-nlp-ja",route:"/eigovision/core-nlp-ja",frontMatter:{type:"tag",date:"2024-12-04T00:00:00.000Z"}},{kind:"MdxPage",name:"privacy-policy",route:"/eigovision/privacy-policy",frontMatter:{type:"tag",date:"2025-02-15T00:00:00.000Z"}},{kind:"MdxPage",name:"support",route:"/eigovision/support",frontMatter:{type:"tag",date:"2025-02-15T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/eigovision/terms-and-conditions",frontMatter:{type:"tag",date:"2025-02-15T00:00:00.000Z"}},{kind:"Meta",data:{"privacy-policy":"Privacy Policy",support:"Support","terms-and-conditions":"Terms and Conditions","core-nlp-en":"Core Nlp En","core-nlp-ja":"Core Nlp Ja"}}]},{kind:"Folder",name:"english_reading",route:"/english_reading",children:[{kind:"MdxPage",name:"privacy-policy",route:"/english_reading/privacy-policy",frontMatter:{type:"tag",date:"2023-01-15T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/english_reading/terms-and-conditions",frontMatter:{type:"tag",date:"2023-01-15T00:00:00.000Z"}},{kind:"Meta",data:{"privacy-policy":"Privacy Policy","terms-and-conditions":"Terms and Conditions"}}]},{kind:"Folder",name:"etymology",route:"/etymology",children:[{kind:"MdxPage",name:"privacy-policy",route:"/etymology/privacy-policy",frontMatter:{type:"tag",date:"2023-01-15T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/etymology/terms-and-conditions",frontMatter:{type:"tag",date:"2023-01-15T00:00:00.000Z"}},{kind:"Meta",data:{"privacy-policy":"Privacy Policy","terms-and-conditions":"Terms and Conditions"}}]},{kind:"MdxPage",name:"index",route:"/",frontMatter:{type:"page",title:"Ap
1ps",date:"2022-07-24T00:00:00.000Z"}},{kind:"Folder",name:"listen-to-novels",route:"/listen-to-novels",children:[{kind:"MdxPage",name:"display-mode-en",route:"/listen-to-novels/display-mode-en",frontMatter:{type:"tag",date:"2025-08-21T00:00:00.000Z"}},{kind:"MdxPage",name:"display-mode-ja",route:"/listen-to-novels/display-mode-ja",frontMatter:{type:"tag",date:"2025-08-21T00:00:00.000Z"}},{kind:"MdxPage",name:"faq-en",route:"/listen-to-novels/faq-en",frontMatter:{type:"tag",date:"2023-05-08T00:00:00.000Z"}},{kind:"MdxPage",name:"how-to-use-en",route:"/listen-to-novels/how-to-use-en",frontMatter:{type:"tag",date:"2023-12-17T00:00:00.000Z"}},{kind:"MdxPage",name:"how-to-use-ja",route:"/listen-to-novels/how-to-use-ja",frontMatter:{type:"tag",date:"2023-12-17T00:00:00.000Z"}},{kind:"MdxPage",name:"privacy-policy",route:"/listen-to-novels/privacy-policy",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"MdxPage",name:"regex-ja",route:"/listen-to-novels/regex-ja",frontMatter:{type:"tag",date:"2023-10-20T00:00:00.000Z"}},{kind:"MdxPage",name:"support",route:"/listen-to-novels/support",frontMatter:{type:"tag",date:"2025-02-11T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/listen-to-novels/terms-and-conditions",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"Meta",data:{"display-mode-en":"Display Mode En","display-mode-ja":"Display Mode Ja",support:"Support","privacy-policy":"Privacy Policy","terms-and-conditions":"Terms and Conditions","how-to-use-en":"How to Use En","how-to-use-ja":"How to Use Ja","regex-ja":"Regex Ja","faq-en":"Faq En"}}]}
1,{kind:"Folder",name:"mangavision",route:"/mangavision",children:[{kind:"MdxPage",name:"privacy-policy",route:"/mangavision/privacy-policy",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"MdxPage",name:"support",route:"/mangavision/support",frontMatter:{type:"tag",date:"2025-02-20T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/mangavision/terms-and-conditions",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"Meta",data:{support:"Support","privacy-policy":"Privacy Policy","terms-and-conditions":"Terms and Conditions"}}]},{kind:"Folder",name:"posts",route:"/posts",children:[{kind:"MdxPage",name:"admob_adaptive_banner",route:"/posts/admob_adaptive_banner",frontMatter:{title:"AdMobのアダプティブバナーをJetpack ComposeとSwiftUIで使用する",date:"2023/1/12",description:"ライブラリには Jetpack Compose や SwiftUI 用のアダプティブバナーは用意されていないので、使用するには一工夫必要になります。",tag:"JetpackCompose, SwiftUI, AdMob, アダプティブバナー",author:"kyamada"}},{kind:"MdxPage",name:"admob_native_ad_android",route:"/posts/admob_native_ad_android",frontMatter:{title:"AdMobのネイティブ広告をJetpack Composeで表示し、プリロード対応する",date:"2023/2/18",description:"Google Mobile Ads SDK は Jetpack Compose に対応していないので、広告のレイアウトは従来の xml で組む必要があります。また、広告表示のタイムラグをなくすためには、広告を事前に取得(プリロード)するのが有効です。",tag:"JetpackCompose, AdMob, ネイティブ広告",author:"kyamada"}},{kind:"MdxPage",name:"android_edge_to_edge",route:"/posts/android_edge_to_edge",frontMatter:{title:"Android 15 の edge-to-edgeに対応する",date:"2025/1/18",description:"Android 15 の edge-to-edge に対応した時の変更点を記載します",tag:"Android, edge-to-edge",author:"kyamada"}},{kind:"MdxPage",name:"android_share_activity",route:"/posts/android_share_activity",frontMatter:{title:"ブラウザの共有からAndroidアプリを開く",date:"2024/10/15",description:"ブラウザの共有からAndroidアプリを開く方法を説明します。",tag:"Android",author:"kyamada"}},{kind:"MdxPage",name:"compose_multiplatform_admob_banner",route:"/posts/compose_multiplatform_admob_banner",frontMatter:{title:"Compose Multiplatform で Admobのバナー広告を表示する",date:"2024/6/3",description:"Compose Multiplatform で、Android/iOSの環境で Admob のバナー広告を表示する方法を解説します。",tag:"Kotlin, ComposeMultiplatform, Admob",author:"kyamada"}},{kind:"MdxPage",name:"compose_multiplatform_keyboard",route:"/posts/compose_multiplatform_keyboard",frontMatter:{title:"Compose Multiplatform で キーボードショートカットを実装する",date:"2024/8/16",description:"Compose Multiplatform で、キーボードショートカット処理を実装する方法を解説します。",tag:"Kotlin, ComposeMultiplatform",author:"kyamada"}},{kind:"MdxPage",name:"compose_multiplatform_subscription",route:"/posts/compose_multiplatform_subscription",frontMatter:{title:"Compose Multiplatform で サブスクリプションを実装する",date:"2025/1/24",description:"Android/iOSの両方でサブスクリプションの課金処理を実装する方法をまとめました。",tag:"Kotlin, ComposeMultiplatform, subscription",author:"kyamada"}},{kind:"MdxPage",name:"create_android_aab_by_command_line",route:"/posts/create_android_aab_by_command_line",frontMatter:{title:"Androidのリリース用App Bundle(.aab)をコマンドラインから生成する",date:"2023/1/13",description:"Android アプリのリリース時に Ap
1pBundle(.aab)を作成する必要があります。GUI から行うと面倒なので、コマンドラインから AppBundle を作成する方法をまとめました。",tag:"Android, aab, App Bundle",author:"kyamada"}},{kind:"MdxPage",name:"flutter_exists_image",route:"/posts/flutter_exists_image",frontMatter:{title:"Flutterで画像が存在するかどうかを画像をロードせずに調べる方法",date:"2022/9/14",description:"画像の存在チェックをするコードを自動生成するスクリプトを作成します",tag:"flutter, existsImageFile",author:"kyamada"}},{kind:"MdxPage",name:"flutter_font",route:"/posts/flutter_font",frontMatter:{title:"Flutterでカスタムフォントを導入して発音記号を表示する",date:"2022/9/11",description:"Flutterのデフォルトのフォント(Roboto)で発音記号を表示しようとしたら文字化けしたのですが、カスタムフォントを導入することで解決できたので、その方法を紹介します。",tag:"flutter, font, M+FONTS",author:"kyamada"}},{kind:"MdxPage",name:"flutter_ios_install_error",route:"/posts/flutter_ios_install_error",frontMatter:{title:"FlutterでビルドしたipaファイルがTestFlightでインストールできない問題の解決法",date:"2022/9/21",description:"bundle identifierの末尾に .add を追加すると解決します。",tag:"flutter, iOS",author:"kyamada"}},{kind:"MdxPage",name:"get_csr_html_multiplatform",route:"/posts/get_csr_html_multiplatform",frontMatter:{title:"CSRのHTMLをAndroidとiOSで取得する方法",date:"2023/1/2",description:"CSR(クライアントサイドレンダリング)で生成されるHTMLを取得する方法です",tag:"Android, iOS, html, CSR, javascript",author:"kyamada"}},{kind:"MdxPage",name:"index",route:"/posts",frontMatter:{type:"posts",title:"Blog",date:"2021-03-18T00:00:00.000Z"}},{kind:"MdxPage",name:"ios_background_process",route:"/posts/ios_background_process",frontMatter:{title:"iOSアプリがバックグラウンド状態の時に処理を継続する方法",date:"2022/10/9",description:"iOSアプリでバックグラウンド中に処理を継続する方法を調べ、実現可能だった方法と不可だった方法に分類しました。",tag:"ios, background, ble",author:"kyamada"}},{kind:"MdxPage",name:"ios_share_extension",route:"/posts/ios_share_extension",frontMatter:{title:"iOS の Share Extensionで Safari からアプリを開く",date:"2023/2/9",description:"iOS アプリに Share Extension を導入し、Safari からアプリを開く方法を説明します。",tag:"iOS, Share Extension, Safari",author:"kyamada"}},{kind:"MdxPage",name:"jetpack_compose_shared_storage_document",route:"/posts/jetpack_compose_shared_storage_document",frontMatter:{title:"JetpackCompose から 共有ストレージのファイルにアクセスする",date:"2023/8/18",description:"1. ユーザにフォルダーを選択させ、そこにファイルを作成する。2. ユーザにファイルを選択させ、その内容を読み取る",tag:"JetpackCompose,CreateDocument,OpenDocument",author:"kyamada"}},{kind:"MdxPage",name:"kotlin_multiplatform_recommended_libs",route:"/posts/kotlin_multiplatform_recommended_libs",frontMatter:{title:"Kotlin Multiplatform (KMP) の使い方やお勧めのライブラリの紹介",date:"2024/5/25",description:null,tag:"Kotlin, Compose",author:"kyamada"}},{kind:"MdxPage",name:"kotlin_native_string_replace_bug",route:"/posts/kotlin_native_string_replace_bug",frontMatter:{title:"Kotlin/Nativeの String.replace のバグを回避する",date:"2023/2/14",description:"Kotlin/Nativeの String.replace を使うとiOSでバグが発生します。それを回避する方法を説明します",tag:"KotlinNative",author:"kyamada"}},{kind:"MdxPage",name:"ktor_okio_download_file",route:"/posts/ktor_okio_download_file",frontMatter:{title:"ktor と okio を使って大きなファイルをダウンロードする",date:"2024/5/10",description:"大きなファイルをダウンロードする場合、ファイルの内容をすべてメモリに展開してしまうと、OutOfMemoryError が発生してしまいます。",tag:"Multiplatform,ktor,okio",author:"kyamada"}},{kind:"MdxPage",name:"moomoo_acm_dns",route:"/posts/moomoo_acm_dns",frontMatter:{title:"ムームードメインでAWS Certificate Manager(ACM)のSSL証明書を取得する",date:"2022/7/24",description:"ムームードメインでドメインを取得し、AWS Certificate Manager(ACM)のSSL 証明書を取得する方法を説明します。",tag:"acm, moomoo, dns",author:"kyamada"}},{kind:"MdxPage",name:"nextjs_portfolio",route:"/posts/nextjs_portfolio",frontMatter:{title:"next.jsでポートフォリオサイトを作ってS3にデプロイする",date:"2022/7/25",description:"nextjs-portfolio-starterをベースにポートフォリオサイトを作成し、S3にデプロイする方法を説明します。",tag:"next.js, s3",author:"kyamada"}},{kind:"MdxPage",name:"nextjs_s3_cloudfront_dynamic_routes",route:"/posts/nextjs_s3_cloudfront_dynamic_routes",frontMatter:{title:"next.jsをS3+CloudFrontにデプロイした時に、Dynamic Routesを処理する方法",date:"2022/9/19",description:"pages/404.tsxの作成し、CloudFrontでカスタムエラーレスポンスを作成します",tag:"next.js, s3, cloudfront",author:"kyamada"}},{kind:"MdxPage",name:"react_scroll_position_from_bottom",route:"/posts/react_scroll_position_from_bottom",frontMatter:{title:"Reactでスクロール可能な要素の下からのスクロールポジションを取得する",date:"2022/6/21",description:"Reactでスクロール可能な要素の下からのスクロールポジションを取得する方法です",tag:"react, next.js",author:"kyamada"}},{kind:"MdxPage",name:"reducing_mac_system_data_storage",route:"/posts/reducing_mac_system_data_storage",frontMatter:{title:"Macのシステムデータの容量を削減する",date:"2026/3/6",description:"Macのシステムデータの容量が600GBを超えていたので、原因を調べて容量を削減しました。",tag:"Mac, Storage",author:"kyamada"}},{kind:"MdxPage",name:"swiftui_document_picker",route:"/posts/swiftui_document_picker",frontMatter:{title:"Swift
1UI から UIDocumentPickerViewController を呼び出す",date:"2023/8/18",description:"1. ユーザにフォルダーを選択させ、そこにファイルを作成する。2. ユーザにファイルを選択させ、その内容を読み取る",tag:"SwiftUI, UIDocumentPickerViewController",author:"kyamada"}},{kind:"MdxPage",name:"swiftui_textfield_in_sheet",route:"/posts/swiftui_textfield_in_sheet",frontMatter:{title:"SwiftUIのTextFieldに入力した1文字目が変換対象にならない問題とその対処法",date:"2023/3/13",description:"TextField に日本語入力キーボードで文字を入力すると、1 文字目が変換対象にならないことがあります。例えば、キーボードで「a」「u」と入力すると、1文字目の「あ」が変換対象になりません。",tag:"SwiftUI, TextField, UITextField",author:"kyamada"}},{kind:"MdxPage",name:"ump_sdk_reject",route:"/posts/ump_sdk_reject",frontMatter:{title:"Googleの User Messaging Platform (UMP) SDK でGDPRに対応したら、AppStoreの審査でリジェクトされた",date:"2023/12/22",description:"ようするに、ATTメッセージを表示する前に、同意を促すようなメッセージ(ここではGDPRメッセージ)を表示してはいけないようです。",tag:"UMP, GDPR, ATT",author:"kyamada"}},{kind:"MdxPage",name:"webview_http",route:"/posts/webview_http",frontMatter:{title:"AndroidとiOSのWebViewでhttp通信を許可する",date:"2024/11/14",description:"全てのドメインに対してHTTPのクリアテキスト通信を許可したい場合は...",tag:"Android, iOS, WebView",author:"kyamada"}},{kind:"Meta",data:{reducing_mac_system_data_storage:"Macのシステムデータの容量を削減する",compose_multiplatform_subscription:"Compose Multiplatform で サブスクリプションを実装する",android_edge_to_edge:"Android 15 の edge-to-edgeに対応する",webview_http:"AndroidとiOSのWebViewでhttp通信を許可する",android_share_activity:"ブラウザの共有からAndroidアプリを開く",compose_multiplatform_keyboard:"Compose Multiplatform で キーボードショートカットを実装する",compose_multiplatform_admob_banner:"Compose Multiplatform で Admobのバナー広告を表示する",kotlin_multiplatform_recommended_libs:"Kotlin Multiplatform (KMP) の使い方やお勧めのライブラリの紹介",ktor_okio_download_file:"ktor と okio を使って大きなファイルをダウンロードする",ump_sdk_reject:"Googleの User Messaging Platform (UMP) SDK でGDPRに対応したら、AppStoreの審査でリジェクトされた",jetpack_compose_shared_storage_document:"JetpackCompose から 共有ストレージのファイルにアクセスする",swiftui_document_picker:"SwiftUI から UIDocumentPickerViewController を呼び出す",swiftui_textfield_in_sheet:"SwiftUIのTextFieldに入力した1文字目が変換対象にならない問題とその対処法",admob_native_ad_android:"AdMobのネイティブ広告をJetpack Composeで表示し、プリロード対応する",kotlin_native_string_replace_bug:"Kotlin/Nativeの String.replace のバグを回避する",ios_share_extension:"iOS の Share Extensionで Safari からアプリを開く",create_android_aab_by_command_line:"Androidのリリース用App Bundle(.aab)をコマンドラインから生成する",admob_adaptive_banner:"AdMobのアダプティブバナーをJetpack ComposeとSwiftUIで使用する",get_csr_html_multiplatform:"CSRのHTMLをAndroidとiOSで取得する方法",ios_background_process:"iOSアプリがバックグラウンド状態の時に処理を継続する方法",flutter_ios_install_error:"FlutterでビルドしたipaファイルがTestFlightでインストールできない問題の解決法",nextjs_s3_cloudfront_dynamic_routes:"next.jsをS3+CloudFrontにデプロイした時に、Dynamic Routesを処理する方法",flutter_exists_image:"Flutterで画像が存在するかどうかを画像をロードせずに調べる方法",flutter_font:"Flutterでカスタムフォントを導入して発音記号を表示する",nextjs_portfolio:"next.jsでポートフォリオサイトを作ってS3にデプロイする",moomoo_acm_dns:"ムームードメインでAWS Certificate Manager(ACM)のSSL証明書を取得する",react_scroll_position_from_bottom:"Reactでスクロール可能な要素の下からのスクロールポジションを取得する",index:"Blog"}}]},{kind:"Folder",name:"translation-browser",route:"/translation-browser",children:[{kind:"MdxPage",name:"privacy-policy",route:"/translation-browser/privacy-policy",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/translation-browser/terms-and-conditions",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"Meta",data:{"privacy-policy":"Privacy Policy","terms-and-conditions":"Terms and Conditions"}}]},{kind:"Folder",name:"voicevox-tts",route:"/voicevox-tts",children:[{kind:"MdxPage",name:"privacy-policy",route:"/voicevox-tts/privacy-policy",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"MdxPage",name:"support",route:"/voicevox-tts/support",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}},{kind:"MdxPage",name:"terms-and-conditions",route:"/voicevox-tts/terms-and-conditions",frontMatter:{type:"tag",date:"2025-01-24T00:00:00.000Z"}}
1,{kind:"Meta",data:{"privacy-policy":"Privacy Policy",support:"Support","terms-and-conditions":"Terms and Conditions"}}]},{kind:"Meta",data:{about:"About",index:"Apps"}}],flexsearch:{codeblocks:!0},title:"iOS の Share Extensionで Safari からアプリを開く",headings:v},pageNextRoute:"/posts/ios_share_extension",nextraLayout:i.ZP,themeConfig:r.Z};var g=(0,t.j)(f)},757:function(e){e.exports={screenshots:"posts_screenshots__IO07e"}}},function(e){e.O(0,[1917,9774,2888,179],function(){return e(e.s=8893)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.