UIWindowScene: session property
The session property is this scene's session, a UISceneSession: the scene's persistent identity.
Value
- Read-only. Assigning to it throws
TypeError. - Determined by the system. Every read on the same scene returns the same object.
- When the system destroys the scene and creates a new scene object, the new scene's
sessionrepresents the same UI:persistentIdentifieris the same, and the data stored inuserInfois still there. Not verified in the simulator.
Examples
js
application.addEventListener('sceneconnect', (e) => {
const session = e.scene.session;
console.log(session === e.scene.session);
console.log(session.role);
});Result: logs true and then UIWindowSceneSessionRoleApplication.
Corresponding iOS API
UIScene.session.