{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["json-schema"]},"type":"markdown"},"seo":{"title":"Scene Changes","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":["openapi"],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"scene-changes","__idx":0},"children":["Scene Changes"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"taptopaysdkdidchangescenephase-scenephase-async","__idx":1},"children":["tapToPaySdk.didChange(scenePhase: ScenePhase) async"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Notifies the SDK that the scene has changed in the application. Readers can disconnect if the application is sent to the background. Therefore, it is necessary to notify the SDK about the scene changing to handle the disconnection and re-connection of the reader."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This modifier should be added to the main ContentView of the application."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"public func didChange(scenePhase: ScenePhase) async\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters","__idx":2},"children":["Parameters"]},{"$$mdtype":"Tag","name":"JsonSchema","attributes":{"schema":{"type":"object","properties":{"scenePhase":{"type":"ScenePhase","description":"An indication of a scene's operational state."}},"required":["scenePhase"]},"options":{"schemaExpansionLevel":1},"schemaResolved":{"openapi":"3.1.0","components":{"schemas":{"__root":{"type":"object","properties":{"scenePhase":{"type":"ScenePhase","description":"An indication of a scene's operational state."}},"required":["scenePhase"]}}}},"schemaResolvedErrors":[]},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-usage","__idx":3},"children":["Example Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"//\n//  ContentView.swift\n//\n\nimport Foundation\nimport SwiftUI\n\nstruct ContentView: View {\n  @Environment(\\.scenePhase) private var scenePhase\n  private let tapToPaySdk: TyroTapToPay\n\n  var body: some View {\n    VStack {\n      Text(\"App main content view\")\n    }\n    .onChange(of: scenePhase) { (_, newValue) in\n      Task.detached {\n        await tapToPaySdk.didChange(scenePhase: newValue)\n      }\n    }\n  }\n}\n","lang":"swift"},"children":[]}]},"headings":[{"value":"Scene Changes","id":"scene-changes","depth":1},{"value":"tapToPaySdk.didChange(scenePhase: ScenePhase) async","id":"taptopaysdkdidchangescenephase-scenephase-async","depth":2},{"value":"Parameters","id":"parameters","depth":3},{"value":"Example Usage","id":"example-usage","depth":2}],"frontmatter":{"title":"Scene changes","seo":{"title":"Scene Changes"}},"lastModified":"2026-09-02T01:02:13.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/in-person-payments/tap-to-pay/ios/sdk/scene-changes","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}