<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tiffa.net/w/index.php?action=history&amp;feed=atom&amp;title=SwiftUI%2FProtocol%2FScene</id>
	<title>SwiftUI/Protocol/Scene - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tiffa.net/w/index.php?action=history&amp;feed=atom&amp;title=SwiftUI%2FProtocol%2FScene"/>
	<link rel="alternate" type="text/html" href="https://wiki.tiffa.net/w/index.php?title=SwiftUI/Protocol/Scene&amp;action=history"/>
	<updated>2026-06-10T14:28:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.tiffa.net/w/index.php?title=SwiftUI/Protocol/Scene&amp;diff=2216&amp;oldid=prev</id>
		<title>imported&gt;Fire: Created page with &quot;{{Infobox Swift |name=Scene |Type=protocol |iOS=14.0 |iPadOS=14.0 |macOS=11.0 |MacCatalyst=14.0 |tvOS=14.0 |watchOS=7.0 |Website={{URL|https://developer.apple.com/documentation/swiftui/scene/}} }}  アプリのユーザーインターフェースの一部で、システムによって管理されるライフサイクルのこと。  環境変数scenePhaseを使うと onChange のときに状態に応じた処理分岐がかけられる。  enum型で、下記値をとる...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tiffa.net/w/index.php?title=SwiftUI/Protocol/Scene&amp;diff=2216&amp;oldid=prev"/>
		<updated>2022-11-11T09:52:24Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Infobox Swift |name=Scene |Type=protocol |iOS=14.0 |iPadOS=14.0 |macOS=11.0 |MacCatalyst=14.0 |tvOS=14.0 |watchOS=7.0 |Website={{URL|https://developer.apple.com/documentation/swiftui/scene/}} }}  アプリのユーザーインターフェースの一部で、システムによって管理されるライフサイクルのこと。  環境変数scenePhaseを使うと onChange のときに状態に応じた処理分岐がかけられる。  enum型で、下記値をとる...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox Swift&lt;br /&gt;
|name=Scene&lt;br /&gt;
|Type=protocol&lt;br /&gt;
|iOS=14.0&lt;br /&gt;
|iPadOS=14.0&lt;br /&gt;
|macOS=11.0&lt;br /&gt;
|MacCatalyst=14.0&lt;br /&gt;
|tvOS=14.0&lt;br /&gt;
|watchOS=7.0&lt;br /&gt;
|Website={{URL|https://developer.apple.com/documentation/swiftui/scene/}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
アプリのユーザーインターフェースの一部で、システムによって管理されるライフサイクルのこと。&lt;br /&gt;
&lt;br /&gt;
環境変数scenePhaseを使うと onChange のときに状態に応じた処理分岐がかけられる。&lt;br /&gt;
&lt;br /&gt;
enum型で、下記値をとる&lt;br /&gt;
;.active&lt;br /&gt;
:フォアグラウンドでインタラクティブな状態&lt;br /&gt;
;.inactive&lt;br /&gt;
:フォアグラウンドであるが作業がポーズ状態&lt;br /&gt;
;.background&lt;br /&gt;
:UIが現在表示されていない状態&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Swift&amp;quot;&amp;gt;&lt;br /&gt;
struct MyScene: Scene {&lt;br /&gt;
    @Environment(\.scenePhase) private var scenePhase&lt;br /&gt;
    @StateObject private var cache = DataCache()&lt;br /&gt;
&lt;br /&gt;
    var body: some Scene {&lt;br /&gt;
        WindowGroup {&lt;br /&gt;
            MyRootView()&lt;br /&gt;
        }&lt;br /&gt;
        .onChange(of: scenePhase) { newScenePhase in&lt;br /&gt;
            if newScenePhase == .background {&lt;br /&gt;
                cache.empty()&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Link ==&lt;br /&gt;
[https://qiita.com/imchino/items/988a3f3bdc73953fb92e 【SwiftUI】Sceneプロトコルを読む]&lt;br /&gt;
&lt;br /&gt;
[[Category:SwiftUI/Protocol|Scene]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Fire</name></author>
	</entry>
</feed>